Why does opCall disable struct-literal syntax?

rcorre via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 8 15:26:42 PST 2015


I understand why _static_ opCall would disable it, as a static 
call and struct construction are syntactically similar. But it 
seems like instance opCall and struct literal construction should 
be unambiguous:

struct S { int i; void opCall(int i) { } }
S s = S(3); // clearly a constructor
s(3); // clearly opCall

Is this just a technical limitation, or is there some other 
reasoning?
See (http://dlang.org/operatoroverloading.html#function-call).


More information about the Digitalmars-d mailing list