[Issue 9116] New: Redundant field postblit call on initializing

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 6 00:44:55 PST 2012


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

           Summary: Redundant field postblit call on initializing
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2012-12-06 00:44:54 PST ---
This code doesn't work es expected.

void main()
{
    static struct X {
        int v;
        this(this) { ++v; }
    }
    static struct Y {
        X x;
    }
    X x = X(1);
    assert(x.v == 1);
    Y y = Y(X(1));
    printf("y.x.v = %d\n", y.x.v);  // print 2, but should 1
    assert(y.x.v == 1); // fails
}

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