DMD 2.070 crash with the evil following construct:
-----------------
import std.stdio;
import std.typecons;
import std.range;
void main() {
int id = 0;
switch (id) {
static immutable myArray = iota(100).array;
foreach(i; myArray)
{
case i:
writefln("i: %d", i);
break;
}
default: ;
}
}
-----------------
http://dpaste.dzfl.pl/4acbf36da8a4
Comment #1 by b2.temp — 2017-01-15T23:05:58Z
This case is deprecated now, should this issue be closed then ?
Comment #2 by hsteoh — 2018-06-12T22:57:06Z
Tested on latest git master (153db26c226d84a27a926810025b91eb6583849c), confirmed that this no longer crashes the compiler.
Compiler output:
------
test.d(20): Deprecation: use { } for an empty statement, not ;
test.d(15): Error: case variable i declared at test.d(13) cannot be declared in switch body
------