www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11204] New: Struct is destroyed before constructed

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11204

           Summary: Struct is destroyed before constructed
           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



PDT ---
This illustrates what I meant in bug 10186, comment 6:

struct S {
     disable this(); 

    bool cted;
    this(int x) {
        cted = true;
    }

    static int destroyedBeforeConstructed;
    ~this() {
        if (!cted)
            destroyedBeforeConstructed++;
    }
}

class A {
    S s;

    this() {
        s = S(1);
    }
}

void main() {
    auto a = new A;
    assert(S.destroyedBeforeConstructed == 0);
}

Assertion fails because assignment triggers destruction of a struct that has
never been constructed.

With this one, object lifetime management remains fatally broken.

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


Benjamin Thaut <code benjamin-thaut.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code benjamin-thaut.de



PDT ---
This is most likely a duplicate of:
http://d.puremagic.com/issues/show_bug.cgi?id=8360

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


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



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

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