Bug 16173 – Implicit fall through is silently allowed

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-06-14T16:03:00Z
Last change time
2016-06-14T16:09:18Z
Assigned to
nobody
Creator
4burgos

Comments

Comment #0 by 4burgos — 2016-06-14T16:03:26Z
``` import std.stdio; import std.conv; void main(string[] argv) { int x = to!(int)(argv[1]); switch (x) { case 1: writeln("From 1"); case 2: writeln("From 2"); x = 3; break; case 3: x = 4; default: break; } writeln("x = ", x); } ``` ``` $ rdmd test.d 1 From 1 From 2 x = 3 ```
Comment #1 by 4burgos — 2016-06-14T16:05:15Z
(In reply to Nemanja Boric from comment #0) > ``` > import std.stdio; > import std.conv; > void main(string[] argv) > { > int x = to!(int)(argv[1]); > switch (x) { > case 1: > writeln("From 1"); > case 2: > writeln("From 2"); > x = 3; > break; > case 3: > x = 4; > default: > break; > } > > writeln("x = ", x); > } > ``` > ``` > $ rdmd test.d 1 > From 1 > From 2 > x = 3 > ``` DMD v2.071.0
Comment #2 by 4burgos — 2016-06-14T16:09:18Z
It's reported as a warning (`-w` displays it). *** This issue has been marked as a duplicate of issue 14411 ***