[Issue 12558] New: try/catch allows implicit catching of Throwables without specify any Exception type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 11 03:34:50 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12558

          Issue ID: 12558
           Summary: try/catch allows implicit catching of Throwables
                    without specify any Exception type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com

-----
import std.stdio;

void main()
{
    try {
        assert(0);
    } catch
        writeln("Caught a Throwable");
}
-----

$ dmd -run test.d
> Caught a Throwable

This is a misfeature and should be removed with prejudice. At the very least it
should only ever attempt to catch Exceptions and not Errors/Throwables, but I
fail to see how drowning exceptions without ever inspecting them is a good
thing.

--


More information about the Digitalmars-d-bugs mailing list