Not cleaning up after an Error is thrown is allowed by the D spec. This enhancement allows much better code to be generated for `nothrow` code when `scope` is used. It will also not unwind declarations with destructors in `nothrow` code when Errors are thrown.
It also fixes regression https://issues.dlang.org/show_bug.cgi?id=17493
Comment #5 by moonlightsentinel — 2020-09-05T14:48:37Z
This issue was never fixed:
=====================================
import core.stdc.stdio : puts;
void main()
{
scope (exit) puts("Hello, World!");
throwError();
}
void throwError()
{
throw new Error("");
}
=====================================
Hello, World!
object.Error@(0)
----------------
onlineapp.d:11 void onlineapp.throwError() [0x5579194b2bea]
onlineapp.d:6 _Dmain [0x5579194b2b78]
Comment #6 by dlang-bot — 2020-10-24T00:34:16Z
@WalterBright updated dlang/dmd pull request #6896 "fix Issue 17494 - Do not execute scope(...) if an Error exception has…" fixing this issue:
- fix Issue 17494 - Do not execute scope(...) if an Error exception has been thrown
https://github.com/dlang/dmd/pull/6896
Comment #7 by robert.schadek — 2024-12-13T18:52:34Z