proposed @noreturn attribute
Moritz Maxeiner via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 18 15:21:11 PDT 2017
On Tuesday, 18 July 2017 at 21:45:27 UTC, Adam D. Ruppe wrote:
> On Tuesday, 18 July 2017 at 21:35:21 UTC, Moritz Maxeiner wrote:
>> Could you explain why `return foo();` is even legal for a
>> `void foo() {}`?
>
> Suppose you are writing a template function that forwards:
>
> auto forward(alias fun, T...)(T args) {
> return fun(args);
> }
>
>
> It just saves you from having to static if(fun returns void).
That's a good pragmatic (syntactic sugar) reason, thanks.
More information about the Digitalmars-d
mailing list