www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12558] New: try/catch allows implicit catching of Throwables


          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 puremagic.com
          Reporter: andrej.mitrovich gmail.com

import std.stdio;

void main()
    try {
    } 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. --
Apr 11 2014