www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22364] New: Unreachable warning for collectException[Msg]


          Issue ID: 22364
           Summary: Unreachable warning for collectException[Msg] with
                    noreturn value
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

Passing a noreturn value to either collectException or collectExceptionMsg
triggers the "statement is not reachable" warning for the additional return
statement when no exception is thrown.


noreturn foo() { throw new Exception(""); }

collectException!(Exception, noreturn)(foo());

noreturn n;
collectException!(Exception, noreturn)(foo(), n);

collectExceptionMsg!(Exception, noreturn)(foo());

Oct 07 2021