[Issue 8675] New: Nothrow can't throw Errors
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Sep 17 02:37:26 PDT 2012
    
    
  
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 at puremagic.com
        ReportedBy: monarchdodra at gmail.com
--- Comment #0 from monarchdodra at gmail.com 2012-09-17 02:38:12 PDT ---
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: -------
    
    
More information about the Digitalmars-d-bugs
mailing list