Return values from auto function

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Fri Nov 6 14:58:40 UTC 2020


On Friday, 6 November 2020 at 14:20:40 UTC, Andrey Zherikov wrote:
> On Friday, 6 November 2020 at 12:03:01 UTC, Paul Backus wrote:
>> You can't. Both return values have to have the same type, 
>> which means the failure function has to be able to return more 
>> than one type, which means it has to be a template.
>
> This issue seems hit the inability to implicitly convert custom 
> types. May be it makes more sense to ask in a separate thread.

The return type must be the same for all execution paths.

Result!void is a different type from Result!int. You aren't 
passing a 'Result' because that doesn't exist as a type.

Hopefully one of these captures a misunderstanding.


More information about the Digitalmars-d-learn mailing list