http://d.puremagic.com/issues/show_bug.cgi?id=5989
Summary: Disallow unreachable statements in switch clause Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: andrej.mitrov...@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2011-05-12 15:23:13 PDT --- enum State { init, done } void main() { State state; int x; final switch (state) { x = 5; // <- can never reach this statement case State.init: case State.done: } assert(x == 5); // throws } I've run into this while adding some logging to my code. By accident I've added a print statement right above the case statements inside a final switch, and was puzzled why my code didn't want to log out any information. The above code is clearly an error and I think the compiler should disallow or at least warn about the unreachable statement. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------