www.digitalmars.com         C & C++   DMDScript  

D - duplicate case on string switch is valid

Should this be called a compiler overlook?

void main()
{
	int i;
	switch ( i )
	{
		case 1: break;
//		case 1: break; Case.d(7): duplicate case 1 in switch statement
	}
	
	char[] s;
	
	switch ( s )
	{
		case "one": break;
		case "one": break; // no compiler errors
	}
}

Ant
Mar 23 2004