string[string] opts;
void main()
{
string arg;
switch (arg)
{
case "-f": opts["fore"] = ""; break;
debug { case "-throw": opts["throw"] = ""; break; }
default:
}
}
bug.d(6): Deprecation: 'switch' skips declaration of variable bug.main.__aaval51 at bug.d(8)
dmd 2.072 b1
compile with -debug
Related pull:
Pull https://github.com/dlang/dmd/pull/5869
Comment #1 by greensunny12 — 2018-02-11T02:22:44Z
The problem seems to be due to the associative array.
Reduced a bit further:
---
import std.stdio;
void main()
{
string[string] opts;
switch (2)
{
case 0:
opts["a"] = "";
{
case 1:
break;
}
default:
}
}
---