https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79009
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2018-04-16 Ever confirmed|0 |1 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Confirmed. Clang rejects the original with: auto.cc:5:3: error: 'auto' deduced as 'long' in declaration of 'i' and deduced as 'int' in declaration of 'j' auto i = t, j = 1; ^ ~ ~ auto.cc:25:3: note: in instantiation of function template specialization 'foo<long>' requested here foo (0L); ^ auto.cc:12:3: error: 'auto' deduced as 'int' in declaration of 'i' and deduced as 'long' in declaration of 'j' auto i = 1, j = t, k = 2; ^ ~ ~ auto.cc:26:3: note: in instantiation of function template specialization 'bar<long>' requested here bar (0L); ^ auto.cc:19:3: error: 'auto' deduced as 'int' in declaration of 'i' and deduced as 'long' in declaration of 'j' auto i = t, j = u; ^ ~ ~ auto.cc:27:3: note: in instantiation of function template specialization 'foo<int, long>' requested here foo (1, 2L); ^ 3 errors generated. And similarly for comment 2: auto.cc:7:9: error: 'auto' deduced as 'S<int>' in declaration of 's' and deduced as 'int' in declaration of 'i' auto s = S<T>(), i = 1; ^ ~~~~~~ ~ auto.cc:11:9: note: in instantiation of function template specialization 'f<int>' requested here f<int>(); ^ 1 error generated.