www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8675] New: Nothrow can't throw Errors

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8675

           Summary: Nothrow can't throw Errors
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com



A nothrow function will refuse an explicit call to "throw Error":

nothrow void foo()
{
    assert(1, "Some error");
    assert(0, "Some error");
}
//This is fine

nothrow void bar()
{
    throw new Error("Some error");
}
//This is NOT fine
Error: object.Error is thrown but not caught
Error: function main.bar 'bar' is nothrow yet may throw

nothrow void baz()
{
    try
    {
        throw new Error("Some error");
    }
    catch(Exception)
    {
    }
}
//This works though (!)
//Obviously, the "Error" is not caught...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8675




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d77b7c2bf456e99495d8a6644a6304995d1a3b20
fix Issue 8675 - Nothrow can't throw Errors

- fixed by checking whether the thrown exception is derived
  from Error before complaining about uncaught throws

https://github.com/D-Programming-Language/dmd/commit/fb733a0f5fc9fa49ee58fcf7a19ca8e35d2e98bc


fix Issue 8675 - Nothrow can't throw Errors

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 18 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8675


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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