Struct field destructor not called when exception is thrown in the main struct destructor

Paul Backus snarwin at gmail.com
Fri Oct 16 15:19:51 UTC 2020


On Friday, 16 October 2020 at 13:12:04 UTC, tchaloupka wrote:
> So when the exception is thrown within Foo destructor (and it's 
> bad on it's own but can easily happen as destructors aren't 
> nothrow @nogc by default).
>
> Is this behavior expected?

This is a compiler/language bug. It was fixed in DMD 2.083.0, but 
the new behavior requires a -preview switch, since it has the 
potential to break code.

More information:

- https://dlang.org/changelog/2.083.0.html#reboot14246
- https://dlang.org/changelog/2.085.0.html#preview-flags


More information about the Digitalmars-d-learn mailing list