Function with try/catch and no return statement
Don
nospam at nospam.com
Sat Feb 6 07:19:53 PST 2010
Jacob Carlborg wrote:
> 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.
It gives an error for me on Windows when compiled with -w. If it doesn't
on Mac, that's definitely a bug.
More information about the Digitalmars-d
mailing list