DMD 2.102.2:
The following code is correctly rejected due to switch case fallthrough:
---
import std.stdio;
void main(){
int i=2;
switch(i){
default: writeln("default"); break;
case 0: writeln(0);
case 1: writeln(1);
case 2: writeln(2);
case 3: writeln(3);
case 4: writeln(4);
}
}
---
However, the switch case fallthrough errors are not emitted when generating the cases with `static foreach`:
---
import std.stdio;
void main(){
int i=2;
switch(i){
default: writeln("default"); break;
static foreach(j;0..5)
case j: writeln(j);
}
}
---
Comment #1 by robert.schadek — 2024-12-13T19:27:36Z