www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11542] New: scope(failure) messes up nothrow checking

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

           Summary: scope(failure) messes up nothrow checking
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrei erdani.com



PST ---
This code compiles:

void fun() nothrow
{
    scope(failure) {}
    throw new Exception("so sue me");
}

Generally the presence of scope(failure) completely shuts down checking for
nothrow. See discussion in
http://forum.dlang.org/thread/l6ccae$2cmt$1 digitalmars.com?page=3#post-20131118183251.63faaba7:40marco-leise
for a sketch of the desirable/correct behavior.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 18 2013
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11542




PST ---
To wit, this should work under the new semantics:

void fun() nothrow
{
    scope(failure) { throw new Error("wowzers"); }
    throw new Exception("so sue me");
}

This is because nothrow functions may still throw Error. This should work as
well:

void fun() nothrow
{
    scope(failure) assert(0);
    throw new Exception("so sue me");
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 18 2013