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

           Summary: postblit is called for nested structs when assigning
                    `init`
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: verylonglogin....@gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin....@gmail.com> 2012-11-16 
22:40:07 MSK ---
Note that we have zero context pointer in such postblit call:

---
int i;
struct S
{ this(this) { ++i; } }

void main()
{
    S s = S.init;
    assert(i == 0); // postblit not called
    s = S.init;
    assert(i == 0); // postblit not called

    int k;
    static int j = 0;
    struct N
    {
        this(this)
        {
            ++j;
            assert(this.tupleof[$-1] != null); // fails
        }
        void f() { ++k; }
    }

    N n = N.init;
    assert(j == 0); // fails, j = 1, postblit called
    n = N.init;
    assert(j == 0); // fails, j = 2, postblit called
}
---

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

Reply via email to