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: [email protected]
          Reporter: [email protected]

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

--

Reply via email to