www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2925] New: Destructor not called

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

           Summary: Destructor not called
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: andrei metalanguage.com


import std.stdio;

struct S {
    this(int x) {
        writefln("this(%s)", x);
        this.x = x;
    }
    this(this) {
        writefln("this(this) with %s", x);
    }
    ~this() {
        writefln("Going away S(%s)", x);
    }
    int x;
}

S fun1() {
    auto s = S(1);
    return s;
}

S fun2() {
    return S(2);
}

void main() {
    //auto s1 = fun1;
    auto s2 = fun2;
}

This example creates two objects but only destroys one. fun1 illustrates the
correct behavior.


-- 
May 02 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2925


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED





13:35:58 PDT ---
Fixed dmd 2.032

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