[Issue 11272] New: Postblit is called on a nested struct instead on opAssign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 15 04:33:55 PDT 2013


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

           Summary: Postblit is called on a nested struct instead on
                    opAssign
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: samukha at voliacable.com


--- Comment #0 from Max Samukha <samukha at voliacable.com> 2013-10-15 04:33:54 PDT ---
dmd v2.064-devel-339deaa:

struct S
{
    S1 s1;
}

struct S1
{   
    static int assign;
    void opAssign(S1 s1) {
        assign++;
    }

    static int postblit;
    this(this) {
        postblit++;
    }

    static void reset() {
        assign = 0;     
        postblit = 0;
    }
}

void main() {
    {
        S1 s, s2;
        s = s2;
    }

    assert(S1.assign == 1); // ok
    S1.reset();

    {
        S s, s2;
        s = s2;
    }

    assert(S1.assign == 1); // fails, postblit count is 1   
}

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