www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12646] New: Catching Errors should imply nothrow

https://issues.dlang.org/show_bug.cgi?id=12646

          Issue ID: 12646
           Summary: Catching Errors should imply nothrow
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andrej.mitrovich gmail.com

-----
void func() { }

// ok
void test1() nothrow
{
    try
    {
        func();
    }
    catch (Exception th)
    {
    }
}

// Error: function 'test.test2' is nothrow yet may throw
void test2() nothrow
{
    try
    {
        func();
    }
    catch (Error th)
    {
    }
}

void main() { }
-----

--
Apr 25 2014