Bug 10289 – compiler should infer nothrow even if Error is thrown

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-07T01:04:00Z
Last change time
2013-06-10T00:30:06Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-06-07T01:04:34Z
Test case: void foo(E)() { throw new E(""); } void main() nothrow { foo!Exception(); // L7 foo!Error(); // L8 } Output: test.d(7): Error: foo is not nothrow test.d(8): Error: foo is not nothrow test.d(5): Error: function D main 'main' is nothrow yet may throw L7 is expected, but L8 is not good. Today, throwing Error object from a nothrow function is allowed. So, foo!Error should be inferred to nothrow.
Comment #1 by k.hara.pg — 2013-06-07T01:07:52Z
Comment #2 by github-bugzilla — 2013-06-07T14:02:14Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9d901dfe36c548bad2f998f23128484d3db1715a fix Issue 10289 - compiler should infer nothrow even if Error is thrown https://github.com/D-Programming-Language/dmd/commit/3077571190226d14c14d96eac1301bb83b403c41 Merge pull request #2145 from 9rnsr/fix10289 Issue 10289 - compiler should infer nothrow even if Error is thrown