Bug 6900 – Exception Chaining not done for scope(failure)

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2011-11-06T12:54:39Z
Last change time
2024-12-13T17:56:44Z
Assigned to
No Owner
Creator
Jesse Phillips
Moved to GitHub: dmd#18377 →

Comments

Comment #0 by Jesse.K.Phillips+D — 2011-11-06T12:54:39Z
When Using Scope Guards to throw additional exceptions chaining is not done. In the example below 'collide' shows normal Exception Chaining. Then 'collideScope' fails all three asserts. void main() { void collide() { try { try { throw new Exception("e"); } finally { throw new Exception("t"); } } catch(Exception z) { assert(z.msg=="e"); // First thrown Exception assert(z.next !is null); assert(z.next.msg=="t"); // Second thrown Exception } } collide(); void collideScope() { try { scope(failure) throw new Exception("t"); throw new Exception("e"); } catch(Exception z) { assert(z.msg=="e"); // AssertError assert(z.next !is null); // AssertError assert(z.next.msg=="t"); // AssertError } } collideScope(); }
Comment #1 by Jesse.K.Phillips+D — 2011-11-06T13:04:08Z
Oh, changing this to a feature request. It works for scope(exit) which matches the finally clause version. I think it would also be good to do chaining with scope(failure) too though. I've made this an enhancement request.
Comment #2 by robert.schadek — 2024-12-13T17:56:44Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18377 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB