this() not executing code on structs

Bartosz Milewski bartosz-nospam at relisoft.com
Wed Oct 21 13:33:23 PDT 2009


Andrei Alexandrescu Wrote:

>     this() { myCount = count++; }       // ERROR

It's worse than that. Try this:

struct foo {
       this(int dummy = 0) { writeln("Default constructor");}
}

foo x = foo();

Nothing gets printed. If default constructors are disallowed, so should constructors with all parameters defaulted.



More information about the Digitalmars-d mailing list