www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13575] New: Unreachable scope(failure) should be warned


          Issue ID: 13575
           Summary: Unreachable scope(failure) should be warned
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

From issue 11574:
import std.stdio; void someFunc() { scope(failure) { writeln("What?");} // <-- never executed. scope(failure) { writeln("Failed in someFunc()"); return; } throw new Exception("Exception!"); } void main() { try { someFunc(); writeln("Yay, someFunc() is nothrow"); } catch(Exception e) { writeln("An exception in main!"); } } In someFunc, the first scope(failure) is never executed. There's no bug, but I think, if -w specified, dmd should warn the code as that it is not reachable. --
Oct 06 2014