Thread overview
[Issue 11204] New: Struct is destroyed before constructed
Oct 09, 2013
Max Samukha
Oct 09, 2013
Benjamin Thaut
Oct 10, 2013
Kenji Hara
October 09, 2013
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


--- Comment #0 from Max Samukha <samukha@voliacable.com> 2013-10-09 02:59:12 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: -------
October 09, 2013
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


--- Comment #1 from Benjamin Thaut <code@benjamin-thaut.de> 2013-10-09 12:44:10 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: -------
October 10, 2013
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


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-10-10 05:14:26 PDT ---
*** 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: -------