Function with try/catch and no return statement

Jacob Carlborg doob at me.com
Sat Feb 6 05:20:13 PST 2010


The following code does not cause a compile error:

int foo ()
{
	try
		int i;
	
	catch (Exception)
		throw new Exception("");
}

Wouldn't it be quite obvious for the compiler to see that there is no 
return statement in the above function and give a compile error? The 
same also happens with scope(failure).

Mac OS X 10.5.7 dmd 1.056.



More information about the Digitalmars-d mailing list