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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 6 19:37:55 PST 2012


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



--- Comment #3 from bearophile_hugs at eml.cc 2012-12-06 19:37:53 PST ---
(In reply to comment #2)
> Despite this looks like a silent little change, this is a significant
> improvement in D, and it's one of the best improvements for DMD 2.061. This
> removes some useless code from my D2 code base.

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)));
}

-- 
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