https://issues.dlang.org/show_bug.cgi?id=11329
--- Comment #1 from Kenji Hara <[email protected]> --- (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 --
