D-Scanner
D-Scanner copied to clipboard
switch statement scope is broken
import std.stdio;
void main() {
int x = 5;
switch (x) {
case 3:
int y = x + 2;
writeln(y);
break;
default:
int y = x + 3;
writeln(y);
break;
}
}
gives Variable "y" has the same name as a variable defined on line 7. on line 11 even though that's perfectly fine
the bug goes away if default: is replaced with another case whatever: