digitalmars.D.bugs - [Issue 17111] New: DMD accepts switch statement with non-const case
- via Digitalmars-d-bugs (29/29) Jan 20 2017 https://issues.dlang.org/show_bug.cgi?id=17111
https://issues.dlang.org/show_bug.cgi?id=17111 Issue ID: 17111 Summary: DMD accepts switch statement with non-const case variables Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: yshuiv7 gmail.com Example: void main() { alias TestType = ulong; // won't compile if = ubyte import std.stdio; TestType a,b,c; readf("%s %s %s ", &a, &b, &c); switch(c){ case a: writeln("a");break; case b: writeln("b");break; default: assert(false); } } Forum thread: https://forum.dlang.org/post/djfkbbtuckczxmeunmgt forum.dlang.org --
Jan 20 2017