[Issue 19602] Under some circumstances: throwing Error subclasses unwinds without invoking dtors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 22 06:52:47 UTC 2019


--- Comment #3 from Eyal <eyal at weka.io> ---
If you catch to *avoid* program termination -- you leak all destructors,
leaving program in a likely-corrupt state.

Note I did not suggest `nothrow` would apply to Error.

Rather, I suggested that dtors *always* execute, even when Errors are thrown
from `nothrow` functions. Or: replacing the corrupt-unwinding of Errors with a
different error signaling mechanism.

Currently, dtors *usually* execute, depending on arbitrary context. Catching
Error (even unintentionally via catching Throwable) leads to cleanups in D
being unreliable, and corruption being very easy.


More information about the Digitalmars-d-bugs mailing list