digitalmars.D.bugs - [Issue 14728] New: Problems in the switch statement with enumerated
- via Digitalmars-d-bugs (47/47) Jun 23 2015 https://issues.dlang.org/show_bug.cgi?id=14728
https://issues.dlang.org/show_bug.cgi?id=14728 Issue ID: 14728 Summary: Problems in the switch statement with enumerated data types Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: dennis.m.ritchie mail.ru Found by Denis M... https://vk.com/topic-471951_32042913 I think it can not write, but still it is a strange behavior and sometimes even compile. ````` import std.stdio; void main() { int x = 1; long y = 2; switch(x, y) { case x : writeln("1"); break; // Error: variable x cannot be read at compile time case y : writeln("2"); break; default: break; } } ````` import std.stdio; // compiles void main() { int x = 1; int y = 2; switch(x, y) { case x : writeln("1"); break; case y : writeln("2"); break; default: break; } } I think that should be banned in the switch to send the enumerated arguments T... --
Jun 23 2015