Simen kjaeraas:

> One would expect that to work. If void functions did not allow returning
> the results of functions, the above function would have had to be changed
> to something like this:
> 
> ReturnType!Fn wrap( alias Fn )( ParameterTypeTuple!Fn args ) {
>      static if ( is( typeof( return ) == void ) ) {
>          Fn( args );
>      } else {
>          return Fn( args );
>      }
> }

I think you are talking about the foo() case. But the OP is talking about the 
bar() case, that I think it's a compiler bug:

void foo() {}
int bar() { return 1; }
void main()   {
    //return 0; // error
    //return foo(); // OK, foo returns void
    return bar(); // error, bar returns int
}

Bye,
bearophile

Reply via email to