Bug 4223 – Throwing exception in finally block hides original exception

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2010-05-23T02:42:00Z
Last change time
2014-02-15T02:45:36Z
Keywords
diagnostic, wrong-code
Assigned to
bugzilla
Creator
nfxjfg

Comments

Comment #0 by nfxjfg — 2010-05-23T02:42:52Z
The message for assertion "a" will never be displayed, even though it certainly fails: void main() { try { assert(false, "a"); } finally { assert(false, "b"); } } Executing this program should display messages for both cases. Otherwise, it may be impossible to tell what actually failed: assertion b may depend on cleanup code that was supposed to be executed after assertion a. It is not unusual that other, seemingly unrelated, assertions fail once the program's state is "corrupted". Suggested fix: link the exceptions via Throwable.next.
Comment #1 by andrei — 2011-01-07T13:57:15Z
This is an important matter. We don't want under any circumstances to irretrievably lose information. [email protected], I understand you may be frustrated by the slow response, but please don't undo the valuable work you've put into reporting these bugs. Thanks.
Comment #2 by clugdbug — 2011-01-07T14:08:06Z
(In reply to comment #1) > This is an important matter. We don't want under any circumstances to > irretrievably lose information. [email protected], I understand you may be > frustrated by the slow response, but please don't undo the valuable work you've > put into reporting these bugs. Thanks. It's particularly ironic -- this bug was actually fixed. (Fixed in DMD 2.048).
Comment #3 by gide — 2011-01-07T17:10:14Z
Looks fixed. C:\>type bug4223.d void main() { try { assert(false, "a"); } finally { assert(false, "b"); } } C:\>dmd bug4223.d C:\>bug4223 [email protected](5): b [email protected](3): a