www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10289] New: compiler should infer nothrow even if Error is thrown

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: k.hara.pg gmail.com



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: -------
Jun 07 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10289


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/2145

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 07 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10289




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


Issue 10289 - compiler should infer nothrow even if Error is thrown

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 07 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10289


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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