← Back to index
|
Original Bugzilla link
Bug 17807 – Spurious dead code warnings on enum and static variables.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-09-04T19:54:33Z
Last change time
2017-10-01T20:41:00Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
timon.gehr
Comments
Comment #0
by timon.gehr — 2017-09-04T19:54:33Z
From:
http://forum.dlang.org/post/
[email protected]
void trySwitch(int x) { import std.stdio : writeln; SWITCH: final switch (x) { static foreach (y; [ 1, 2, 3 ]) { case y: writeln("found"); break SWITCH; } } } void main(string[] args) { import std.conv : to; trySwitch(args.length > 1 ? to!int(args[1]) : 1); } Compilation: $ dmd -wi ./main.d ./main.d(5): Warning: statement is not reachable ./main.d(5): Warning: statement is not reachable ./main.d(5): Warning: statement is not reachable ./main.d(5): Warning: statement is not reachable
Comment #1
by timon.gehr — 2017-09-04T20:36:07Z
Reduced test case: int main(string[] args){ int y=0; import std.conv; switch(args[1].to!int){ { case 0: break; } enum x=0; default: y=x; } return y; }
Comment #2
by timon.gehr — 2017-09-04T21:20:28Z
https://github.com/dlang/dmd/pull/7120
Comment #3
by github-bugzilla — 2017-09-15T04:59:30Z
Commits pushed to stable at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/e606297c9138747dc71732046547b5a19829fb05
fix Issue 17807 - Spurious dead code warnings on enum and static variables.
https://github.com/dlang/dmd/commit/891b53a68f253c22b8b857ca66009d0a1df4c963
Merge pull request #7120 from tgehr/fix17807 fix Issue 17807 - Spurious dead code warnings on enum and static variables.
Comment #4
by github-bugzilla — 2017-10-01T20:41:00Z
Commits pushed to master at
https://github.com/dlang/dmd
https://github.com/dlang/dmd/commit/e606297c9138747dc71732046547b5a19829fb05
fix Issue 17807 - Spurious dead code warnings on enum and static variables.
https://github.com/dlang/dmd/commit/891b53a68f253c22b8b857ca66009d0a1df4c963
Merge pull request #7120 from tgehr/fix17807