Bug 3518 – Destructor not called on temporaries

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-11-16T16:27:00Z
Last change time
2015-06-09T01:26:47Z
Assigned to
nobody
Creator
bartosz

Attachments

IDFilenameSummaryContent-TypeSize
499bug.dTest caseapplication/octet-stream1792

Comments

Comment #0 by bartosz — 2009-11-16T16:27:58Z
Created attachment 499 Test case Function f returns (by value) a struct with a destructor. When I assingn the return to a temporary variable, its destructor is called at the end of the scope. If I don't assign it, the destructor of an implicit temporary is not called. In my example this screws up reference counting.
Comment #1 by bartosz — 2009-11-16T16:31:43Z
*** This issue has been marked as a duplicate of issue 3516 ***