On Friday, 16 October 2020 at 16:00:07 UTC, Steven Schveighoffer
wrote:
On 10/16/20 9:12 AM, 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?
I would say it's a bug. The compiler is going to call the
member destructor even if the hand-written destructor does it
too. If the compiler wants to take responsibility for cleaning
up members, it should take full responsibility. In fact, there
is no way to instruct the compiler "I'm handling the
destruction of this member", so I don't see why it should
matter if you exit the function via exception it should be any
different.
-Steve
Thx, added https://issues.dlang.org/show_bug.cgi?id=21322