Bug 4442 – Destructors not called for new-allocated struct objects
Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2010-07-09T20:20:00Z
Last change time
2015-06-09T05:14:52Z
Assigned to
nobody
Creator
andrei
Comments
Comment #0 by andrei — 2010-07-09T20:20:39Z
Example brought up by Sean Kelly in private correspondence:
struct S1{ ~this() { writeln("dtor"); } }
void main() {
auto a = S1();
auto b = new S1();
delete b;
auto c = new S1();
c = null;
GC.collect();
}
"dtor" is only printed twice.
Comment #1 by sandford — 2010-07-09T23:20:00Z
*** This issue has been marked as a duplicate of issue 2834 ***