[Issue 23001] New: missing unreachable code warning with switch inside switch

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 10 04:23:22 UTC 2022


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

          Issue ID: 23001
           Summary: missing unreachable code warning with switch inside
                    switch
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi
                CC: duser at neet.fi

import std.stdio : writeln;
void fn()
{
        switch (1)
        {
                default:
                        break;
                        {
                                writeln("never reached");
                                switch (1) { default: break; }
                        }
        }
}

compile: dmd -w test.d

it will give the warning if the the switch after writeln() is commented out, or
if the block after break; is replaced with the two statements it contains

--


More information about the Digitalmars-d-bugs mailing list