[Issue 22930] New: importC: switch statement gives bogus unreachable code warning

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 25 12:15:41 UTC 2022


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

          Issue ID: 22930
           Summary: importC: switch statement gives bogus unreachable code
                    warning
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi
                CC: duser at neet.fi

with "dmd -wi":

int fn()
{
        switch (1)
        {
                case 2:
                        return 0;
        }
        return 0; // Warning: statement is not reachable
}

seems like any switch that doesn't have at least once case using break; or
falling of the end will give this warning for code after it

--


More information about the Digitalmars-d-bugs mailing list