allowing zero-argument runtime-only struct constructors
kenji hara
k.hara.pg at gmail.com
Sat May 21 01:49:54 PDT 2011
Some days ago, I created patch, and posted pull request #72.
http://d.puremagic.com/issues/show_bug.cgi?id=6036
https://github.com/D-Programming-Language/dmd/pull/72
This patch fixes some opCall problem, and allow a zero-argument
default constructor on stack allocation, even exists multiple-argument
explicit constructors.
> // Calls zero-argument constructor function,
> // due to parentheses after type.
> // Compile-time error if no zero-argument constructor defined.
> MyStruct ms3 = MyStruct();
This will be passing compilation with my patch (unless zero-argument
static opCall is defined).
> // Calls zero-argument constructor function,
> // due to parentheses after type.
> // Compile-time error if no zero-argument constructor defined.
> // This behavior CANNOT BE GOTTEN with new and opCall in current
> // versions of D to my knowledge.
> MyStruct *ms4 = new MyStruct();
Unfortunately, my patch doesn't fix this behavior.
Please post a new report into bugzilla with test cases.
Kenji Hara
More information about the Digitalmars-d
mailing list