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.