Is T.init allowed?

Andrey Zherikov andrey.zherikov at gmail.com
Fri Apr 29 11:30:49 UTC 2022


Seems compiler allows custom nested type with `init` name:

```d
struct T
{
     struct init {}

     int b = 2;
}

void main()
{
     T t;
     writeln(t);        // T(2)
     //writeln(T.init); // Error: cannot pass type `init` as a 
function argument
}
```

Is it a compiler issue so this shouldn't be allowed?
If this is OK then how can I refer to an initial value of `T` 
(`T.init` doesn't work)?


More information about the Digitalmars-d-learn mailing list