On Wed, 14 Jan 2015 23:07:57 +0000 bearophile via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> 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? D spec. i'm not really interested in C++ progress, and certainly not that much that i'll read any of it's specs. > 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. i bet that i read somewhere in specs that return type for `auto` function is defined by first `return` parser sees. yet strangely i can't find it right now. maybe that was changed recently, but i'm almost sure that this is not false memory of mine.
signature.asc
Description: PGP signature