Bug 11542 – scope(failure) messes up nothrow checking

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-18T10:11:00Z
Last change time
2014-05-28T06:55:56Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
andrei

Comments

Comment #0 by andrei — 2013-11-18T10:11:05Z
This code compiles: void fun() nothrow { scope(failure) {} throw new Exception("so sue me"); } Generally the presence of scope(failure) completely shuts down checking for nothrow. See discussion in http://forum.dlang.org/thread/[email protected]?page=3#post-20131118183251.63faaba7:40marco-leise for a sketch of the desirable/correct behavior.
Comment #1 by andrei — 2013-11-18T10:13:13Z
To wit, this should work under the new semantics: void fun() nothrow { scope(failure) { throw new Error("wowzers"); } throw new Exception("so sue me"); } This is because nothrow functions may still throw Error. This should work as well: void fun() nothrow { scope(failure) assert(0); throw new Exception("so sue me"); }
Comment #2 by k.hara.pg — 2014-05-27T06:38:13Z
Comment #3 by github-bugzilla — 2014-05-28T06:55:56Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/aad35c3af1132b59b906171a155f0e21da24c59b fix Issue 11542 - scope(failure) messes up nothrow checking https://github.com/D-Programming-Language/dmd/commit/b72ed88d2394188ea2c08cfbe5b3d2fe8e88c3ef Merge pull request #3592 from 9rnsr/fix11542 Issue 11542 & 12809 - Improve blockExit calculation on try-catch-finally statement