Consider the following program.auto i = 0, f(); int main() {}
In the c++ standard [decl.spec.auto]/8 (http://eel.is/c++draft/dcl.dcl#dcl.spec.auto-8), says:
"If the init-declarator-list contains more than one init-declarator, they shall all form declarations of variables."
If I understand this correctly, shouldn't the program above be ill-formed?
When compiling it with gcc and clang (using -pedantic-errors and -std=c++14) i get no diagnostic message.
auto f(), g();
auto f() { return 0; }
auto f() { return 0.0; }
int main() {}
Clang correctly accepts this, but GCC complains in the following way:
prog.cc: In function 'auto g()': prog.cc:3:19: error: inconsistent deduction for 'auto': 'int' and then 'double' auto g() { return 0.0; } ^
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussio...@isocpp.org.
To post to this group, send email to std-dis...@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-discussion/.