digitalmars.D.bugs - [Issue 13840] New: nothrow attribute affects inside of try-catch
- via Digitalmars-d-bugs (50/50) Dec 09 2014 https://issues.dlang.org/show_bug.cgi?id=13840
https://issues.dlang.org/show_bug.cgi?id=13840 Issue ID: 13840 Summary: nothrow attribute affects inside of try-catch block when using foreach with opApply Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Keywords: rejects-valid Severity: regression Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: sinkuupump gmail.com This is a regression introduced by https://github.com/D-Programming-Language/dmd/pull/3956 ``` struct Foo { int opApply(int delegate(int)) { return 0; } } void func() { } void main() nothrow { try { // *** Error: delegate 'bug.main.__foreachbody1' is nothrow yet may throw foreach (i; Foo()) { func(); // *** Error: 'bug.func' is not nothrow } } catch {} // same for scope(failure) scope(failure) assert(0); // *** Error: delegate 'bug.main.__foreachbody2' is nothrow yet may throw foreach (i; Foo()) { func(); // *** Error: 'bug.func' is not nothrow } } ``` --
Dec 09 2014