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

           Summary: Destructors of struct members get called at the wrong
                    point
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: malteskaru...@web.de


--- Comment #0 from Malte Skarupke <malteskaru...@web.de> 2012-10-31 10:55:37 
PDT ---
The destructor of the member of a struct doesn't get called when I expect it to
be called. I'd expect it to be called at the end of the destructor of the
containing struct. I'm not sure when it gets called instead, but it is too
late. Here is a case that segfaults in DMD 2.060:

void main()
{
    bool destructorCalled = false;
    struct DestructorCounter
    {
        ~this()
        {
            destructorCalled = true; // segmentation fault
        }
    }
    struct S
    {
        DestructorCounter a;
    }
    S s;
}

If this is supposed to be invalid I can provide examples that are most
definitely not supposed to be invalid, but are a bit more lengthy.

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

Reply via email to