[Issue 22364] New: Unreachable warning for collectException[Msg] with noreturn value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 7 19:35:57 UTC 2021


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

          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 at puremagic.com
          Reporter: moonlightsentinel at 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.

Examples:

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

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

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

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

--


More information about the Digitalmars-d-bugs mailing list