digitalmars.D.bugs - [Issue 14264] New: Destructor not called when struct is returned
- via Digitalmars-d-bugs (28/28) Mar 09 2015 https://issues.dlang.org/show_bug.cgi?id=14264
https://issues.dlang.org/show_bug.cgi?id=14264 Issue ID: 14264 Summary: Destructor not called when struct is returned from a parenthesis-less function call Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: dransic gmail.com struct Foo { ~this() { import std.stdio; writeln("I am destroyed"); } } Foo makeFoo() { return Foo(); } void main() { makeFoo(); // I am destroyed makeFoo; // -> destructor is not called } --
Mar 09 2015