[Bug c++/67017] Mixing init-declarator for variables and functions in declaration with auto type-specifier
anders.granlund.0 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 26 21:41:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67017
--- Comment #3 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> EDG and Clang also accept this in C++14 mode (and like GCC, reject it in
> C++11 mode).
(In reply to Anders Granlund from comment #2)
> (In reply to Jonathan Wakely from comment #1)
> > EDG and Clang also accept this in C++14 mode (and like GCC, reject it in
> > C++11 mode).
>
> I think that is because type deduction for return types of functions was
> introduced in c++14.
>
> The following program is well-formed in c++14, but not in c++11:
>
> auto f();
> int main() {}
(In reply to Jonathan Wakely from comment #1)
> EDG and Clang also accept this in C++14 mode (and like GCC, reject it in
> C++11 mode).
It is interesting that the compilers seem to agree, looks like they all have
this bug.
I noticed an interesting thing however. Consider this program:
auto i = 0, f();
auto f() { return false; }
int main() {}
Clang accepts it, but GCC rejects it (I didn't try EDG).
More information about the Gcc-bugs
mailing list