← Back to index
|
Original Bugzilla link
Bug 2925 – Destructor not called
Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-05-02T18:45:00Z
Last change time
2015-06-09T05:14:58Z
Keywords
wrong-code
Assigned to
nobody
Creator
andrei
Comments
Comment #0
by andrei — 2009-05-02T18:45:04Z
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.
Comment #1
by bugzilla — 2009-09-03T13:35:58Z
Fixed dmd 2.032