[Issue 23266] New: Dead else blocks are not considered unreachable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 22 07:37:30 UTC 2022


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

          Issue ID: 23266
           Summary: Dead else blocks are not considered unreachable
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de

This code, built with -w, gives a "statement is not reachable" warning on the
second return:

void main() {
    if (true) return;
    return;
}

This code does not:

void main() {
    if (true) return;
    else return;
}

This despite the else block being just as unreachable.

--


More information about the Digitalmars-d-bugs mailing list