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: [email protected]
Reporter: [email protected]
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/[email protected]
--