[Issue 20216] New: Switch case fall-through not detected for multiple case arguments
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Sep 16 11:36:10 UTC 2019
    
    
  
https://issues.dlang.org/show_bug.cgi?id=20216
          Issue ID: 20216
           Summary: Switch case fall-through not detected for multiple
                    case arguments
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: david.eckardt at frequenz.com
DMD 2.087.1 allows implicit switch case fall-through for cases with multiple
arguments.
--
import std.stdio;
int x = 1;
switch (x)
{
    case 1, 2: writeln("1/2");
    // jump/throw/assert(false) missing, should not compile
    case 3, 4: writeln("3/4");
    // jump/throw/assert(false) missing, should not compile
    default: writeln("default");
}
--
compiles and outputs
--
1/2
3/4
default
--
--
    
    
More information about the Digitalmars-d-bugs
mailing list