Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #67870

Re: Explicitly deduced return type (like "auto foo() -> auto"), is that valid?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c++
Subject Re: Explicitly deduced return type (like "auto foo() -> auto"), is that valid?
Date Thu, 22 Aug 2019 05:05:08 -0700
Organization A noiseless patient Spider
Lines 19
Message-ID <86zhk1h0cr.fsf@mailhub.linuxsc.com> (permalink)
References <qjic31$9ik$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info reader02.eternal-september.org; posting-host="59398aca864cd103291b848dd2e1e135"; logging-data="26432"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VvA8vkT/umK6FiLfX41wsRySN3x4q3Eo="
User-Agent Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock sha1:yM+42TG69kBp1xNdbV4KUoIE9GI= sha1:wEt1jXX0ZSGOEy4L3pmGQeYLR+w=
Xref csiph.com comp.lang.c++:67870

Show key headers only | View raw


"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> writes:

> Specifically, is
>
>     auto foo() -> auto { return 42; }
>
>     auto main() -> int
>     {
>         return foo();
>     }
>
> ... valid?
>
> I'd guess that it's not valid as C++11, but possibly valid as
> C++14 or later.

fwiw, g++ and clang accept it without complaint under -std=c++14
and -std=c++17, but give a diagnostic under -std=c++11.  That
result holds both with and without a -pedantic option.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Explicitly deduced return type (like "auto foo() -> auto"), is that valid? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-08-21 04:59 +0200
  Re: Explicitly deduced return type (like "auto foo() -> auto"), is that valid? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-08-22 05:05 -0700

csiph-web