It is an old feature to emulate constructor call from D1 age. struct S { int num; static S opCall(int n) { S s; s.num = n; return s; } } void main() { S s = 1; // This line is translated to: // S s = S.opCall(1); } But in D2, "implicit constructor call" feature properly supports such the initializing syntax. struct S { int num; this(int n) { this.num = n; } } void main() { S s = 1; // This line is translated to: // S s = S(1); } Therefore, we can deprecate/remove the problematic opCall feature in initializing.
static opCall without any parameters should continue work though, since you can't declare a default constructor.
(In reply to Jonathan M Davis from comment #1) > static opCall without any parameters should continue work though, since you > can't declare a default constructor. This proposal does not change it.
I don't see why this shouldn't work in the absence of a constructor in S. Currently, constructor is preferred if both constructor and opCall are defined. Closing this as WONTFIX.