Would love to override default ctor of struct

Dru dru at notreal.com
Tue Jan 22 21:38:41 UTC 2019


> If D allowed struct's to have a constructor without any 
> parameters, it would not be and could not be a default 
> constructor because of how init works. It would only be a 
> constructor that was called when used explicitly.

the problem is construction of static variables right?
we could allow to define a default ctor and then give an error in 
case it is used for a static variable.

A a; //would error if A has a runtime default ctor

these would still work:
A a = A.init;
A a = void;




More information about the Digitalmars-d mailing list