Bug 13840 – [REG2.067a] nothrow attribute affects inside of try-catch block when using foreach with opApply

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-09T08:08:00Z
Last change time
2015-02-18T03:41:43Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
sinkuupump

Comments

Comment #0 by sinkuupump — 2014-12-09T08:08:01Z
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 } } ```
Comment #1 by k.hara.pg — 2014-12-27T06:35:49Z
Comment #2 by github-bugzilla — 2014-12-31T16:39:05Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9bf5fb4d7c86085aa6b02e678f97f3dc85a99b40 fix Issue 13840 - nothrow attribute affects inside of try-catch block when using foreach with opApply https://github.com/D-Programming-Language/dmd/commit/60bdb8c6991fafe0d6178e7153e249cc3b934809 Merge pull request #4220 from 9rnsr/fix13840 [REG2.067a] Issue 13840 - nothrow attribute affects inside of try-catch block when using foreach with opApply
Comment #3 by github-bugzilla — 2015-02-18T03:41:43Z
Commits pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9bf5fb4d7c86085aa6b02e678f97f3dc85a99b40 fix Issue 13840 - nothrow attribute affects inside of try-catch block when using foreach with opApply https://github.com/D-Programming-Language/dmd/commit/60bdb8c6991fafe0d6178e7153e249cc3b934809 Merge pull request #4220 from 9rnsr/fix13840