On Thursday, 20 September 2012 at 00:14:04 UTC, Jonathan M Davis
wrote:
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
sure, but it's a bit unexpected. do we need to be able to declare
empty functions?
but whats even more confusing: you are not allowed to declare an
no_arg constructor. but you are allowed to declare one where all
parameters have default parameters. but then, how to call it
without args? auto k = S(); doesn't work?