Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #67870
| 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 | 2019-08-22 05:05 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <86zhk1h0cr.fsf@mailhub.linuxsc.com> (permalink) |
| References | <qjic31$9ik$1@dont-email.me> |
"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
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