www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11272] New: Postblit is called on a nested struct instead on opAssign

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: samukha voliacable.com


--- Comment #0 from Max Samukha <samukha 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: -------
Oct 15 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11272



--- Comment #1 from Max Samukha <samukha voliacable.com> 2013-10-15 04:43:18
PDT ---
Changed title to "Postblit is called instead of opAssign on a nested struct"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 15 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11272


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |monarchdodra gmail.com
         Resolution|                            |DUPLICATE


--- Comment #2 from monarchdodra gmail.com 2013-10-15 06:03:31 PDT ---
This is a duplicate of:
http://d.puremagic.com/issues/show_bug.cgi?id=11202

*** This issue has been marked as a duplicate of issue 11202 ***

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