www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - switch bug

I have a switch somthing like this:

void main(char[][] args)
{
	foreach(arg,args)
		if(arg.length >= 2)
			switch(arg[0..2])
			{
				case "-?": ... break;
				case "-a": ... break;
				case "-b": ... break;
				case "-c": ... break;
				default: ... break;
			}
}

when given "-a" it goes to the default

(This is not the exact case so don't expect it to exhibit the bug, I'll try 
to get a minimal test case later today)

This is not the first time I have found this bug. It seems to be a code gen 
issue because adding no-op lines (i = i;) has fixed it in the past.
Sep 15 2007