[Issue 10289] New: compiler should infer nothrow even if Error is thrown

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 7 01:04:35 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10289

           Summary: compiler should infer nothrow even if Error is thrown
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-06-07 01:04:34 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list