June 25, 2015 [Issue 11329] Struct dtor called for a struct with a failed ctor when struct is nested in a class | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11329 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> --- (In reply to Andrej Mitrovic from comment #0) > but for some reason its dtor /is/ > called, however only in a situation when it's nested in a class. The dtor is called from druntime during process finalization. By inserting a print line at the end of main, you can confirm that. void main() { //// S dtor not called (ok, because its ctor failed) //assertThrown!Exception(S(1)); // S dtor called even though S object was not // properly initialized (ctor failed) assertThrown!Exception(new C()); stderr.writeln("end main"); } Prints: $ dmd -run test end main S dtor -- _x: 1 -- |
December 13 [Issue 11329] Struct dtor called for a struct with a failed ctor when struct is nested in a class | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11329 --- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18701 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation