[Issue 5399] Return the result of a nonvoid function in a void function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 2 09:07:41 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5399



--- Comment #7 from Andrei Alexandrescu <andrei at metalanguage.com> 2011-01-02 09:05:29 PST ---
(In reply to comment #6)
> I think the issue is with allowing stuff like this:
> 
> Result wrapCall(alias call, Result, Args...)(Args args) {
>    return call(args);
> }
> 
> And then making it work even if the result of the call is void:
> 
> wrapCall(&something, void, int, int)(1, 2);
> 
> That requires that you can return a void value. Returning a void normally
> wouldn't make sense, but as you can see it simplifies generic programming.

Yes, that's a classic in C++ too. My assessment refers not to forwarding across
void function, but to void functions returning non-void expressions.

To clarify: forwarding from one void function to another void function is
useful. Having a void function return a non-void value should be removed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list