[Issue 2701] Can't declare struct, assign lvalue via opAssign in same statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 1 18:59:43 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2701





------- Comment #1 from daniel.keep+d.puremagic.com at gmail.com  2009-03-01 20:59 -------
You can't use opAssign for initialisation; you have to use opCall. 
Specifically,

Bar bar = foo;

is rewritten as:

Bar bar = Bar(foo);

which is further rewritten as:

Bar bar = Bar.opCall(foo);

I'm not sure if this is documented explicitly anywhere; I just remember this
from when it was implemented.


-- 



More information about the Digitalmars-d-bugs mailing list