[Issue 6937] new with struct doesn't allow field assignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 6 19:46:56 PST 2012


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



--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> 2012-12-06 19:46:54 PST ---
(In reply to comment #3)
> This is not yet allowed to remove some more boilerplate code (the "new"):
> 
> 
> struct Node(T) {
>     T data;
>     Node* left, right;
> }
> void main() {
>     alias N = Node!int;
>     auto t1 = new N(1, new N(2, new N(3))); // OK
>     alias M = Node!int.__ctor; // Not OK
>     auto t2 = M(1, M(2, M(3)));
> }

This is completely unrelated to this issue.
Ideally __ctor should not appear in user code, and language specification would
never support it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list