[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 09:12:17 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19602

--- Comment #6 from Mathias LANG <pro.mathias.lang at gmail.com> ---
(In reply to Jacob Carlborg from comment #5)
>
> For a unit test framework it's useful to catch AssertError to be able to
> continue running other tests.

Yep, however that's covered by the specs:

> Individual tests are specified in the unit test using spec/expression, AssertExpressions. Unlike AssertExpressions used elsewhere, the assert is not assumed to hold, and upon assert failure the program is still in a defined state.

https://dlang.org/spec/unittest.html

(In reply to Eyal from comment #4)
> Just to clarify on my last point, if "auto sneakyThrow" is changed to "void
> sneakyThrow" -- it DOES run the dtor! Because it is no longer inferred to be
> nothrow.
> 
> This is a really unpredictable semantics for a simple program, doesn't feel
> at all reasonable in a language that desires safety.


And that is the real bug, which is reported as 17494

--


More information about the Digitalmars-d-bugs mailing list