www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23001] New: missing unreachable code warning with switch


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

import std.stdio : writeln;
void fn()
        switch (1)
                                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

Apr 09 2022