auto return for some recursive functions in C++11
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jan 14 15:07:57 PST 2015
ketmar:
> the spec says that return type for `auto` function is taken
> from the first `return` operator parser met. so for the
> second `return` the return type is already known.
Do you mean the C++14 spec or the D spec?
The D specs I see are (from: http://dlang.org/function.html ):
> Auto Functions
>
> Auto functions have their return type inferred from any
> ReturnStatements in the function body.
>
> An auto function is declared without a return type. If it does
> not
> already have a storage class, use the auto storage class.
>
> If there are multiple ReturnStatements, the types of them must
> be
> implicitly convertible to a common type. If there are no
> ReturnStatements, the return type is inferred to be void.
Bye,
bearophile
More information about the Digitalmars-d
mailing list