D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3518 - Destructor not called on temporaries
Summary: Destructor not called on temporaries
Status: RESOLVED DUPLICATE of issue 3516
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-16 16:27 UTC by Bartosz Milewski
Modified: 2015-06-09 01:26 UTC (History)
0 users

See Also:


Attachments
Test case (1.75 KB, application/octet-stream)
2009-11-16 16:27 UTC, Bartosz Milewski
Details

Note You need to log in before you can comment on or make changes to this issue.
Description Bartosz Milewski 2009-11-16 16:27:58 UTC
Created attachment 499 [details]
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 Bartosz Milewski 2009-11-16 16:31:43 UTC

*** This issue has been marked as a duplicate of issue 3516 ***