Nick Sabalausky wrote:
"Walter Bright" <[email protected]> wrote in message news:[email protected]...
BCS wrote:
IIRC D allows "return exp;" in a void function because it avoids special cases in template code.

ReturnTypeOf!(AFn, T) fn(T)(T t)
{
   return AFn(t,t); // AFn might return void
}
Yes, that's exactly why.

There has to be a better way to handle that. Making "void foo(){return 1;}" valid code with no warning is just plain sloppy. (In fact, I've been bitten by that before.)


I agree. It's fine to forward a void to a void, but not anything else to a void.


Andrei

Reply via email to