consider the code:
void main () {
import std.stdio;
char ch = '!';
switch (ch) {
int n = 42;
case '!': writeln(n, ": wow!"); break; //(1)
default:
}
}
`n` variable is available at (1), but it is not initialized to 42, it contains random garbage instead.
compiler should either execute all code before first `case` label unconditionally, or forbid having unlabeled code in `switch` block.
Comment #1 by yebblies — 2015-04-30T13:02:47Z
This is the underlying issue in bug 10524 and is closely related to issue 602.