On Tuesday, 10 April 2018 at 18:34:54 UTC, n0fun wrote:
Why the destructor is called in the second case and why not in the first?
The first case is RAII, where destruction isn't done for not fully constructed instances. The second case is GC finalization at program shutdown and looks like a bug, as the GC should probably immediately reclaim the allocated heap memory if construction wasn't successful.