Bug 23762 – Missing switch case fallthrough error when generating cases with `static foreach`

Status
NEW
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-03-07T15:51:39Z
Last change time
2024-12-13T19:27:36Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
timon.gehr
Moved to GitHub: dmd#20242 →

Comments

Comment #0 by timon.gehr — 2023-03-07T15:51:39Z
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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20242 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB