no-arg constructor for structs (again)
Jonathan M Davis
jmdavisProg at gmx.com
Wed Sep 19 17:14:51 PDT 2012
On Thursday, September 20, 2012 00:12:04 Felix Hufnagel wrote:
> 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
> }
Of course that generates a linker error. You just declared a function without
a body.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list