no-arg constructor for structs (again)

deadalnix deadalnix at gmail.com
Thu Sep 20 02:59:41 PDT 2012


Le 20/09/2012 00:12, Felix Hufnagel a écrit :
> isn't it even worse?
>
> import std.stdio;
> struct S
> {
> int i;
> this(void* p = null){this.i = 5;}
> }
> void main()
> {
> //S l(); //gives a linker error
> auto k = S();
> writeln(k.i); //prints 0
> }

Last time I checked it, it was not working. No constructor was called.


More information about the Digitalmars-d mailing list