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


--- Comment #0 from Kenji Hara <k.hara.pg 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: -------
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


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



--- Comment #2 from github-bugzilla puremagic.com 2013-06-07 14:02:14 PDT ---
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

-- 
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