The following code crashes when run on dmd 2.053. windbg.exe stays on line "nop3" when debugged and then the program crashes.
int main(string[] argv)
{
string a="test";
string b="dummy";
switch(b) {
case "nop1": a="apples";
case "nop2": a="oranges";
case "nop3": a="bananas";
}
return 0;
}
Comment #1 by kennytm — 2011-05-28T05:11:01Z
Isn't it expected? A SwitchError will be thrown when there is no default: case and the switch doesn't match.
Comment #2 by bearophile_hugs — 2011-05-28T05:34:31Z
I suggest to compile D code with the -w compiler switch.
Comment #3 by r.k.persson — 2011-05-28T06:38:50Z
Ah! My c++ damaged brain thought it would fall through, but this behaviour is actually better!