The most confusing error message

Petar Petar
Wed Jan 24 07:32:17 UTC 2018


On Wednesday, 24 January 2018 at 07:21:09 UTC, Shachar Shemesh 
wrote:
> test.d(6): Error: struct test.A(int var = 3) is used as a type
>
> Of course it is. That's how structs are used.
>
> Program causing this:
> struct A(int var = 3) {
>     int a;
> }
>
> void main() {
>     A a;
> }
>
> To resolve, you need to change A into A!(). For some reason I 
> have not been able to fathom, default template parameters on 
> structs don't work like they do on functions.

Because IFTI is short for implicit function


More information about the Digitalmars-d mailing list