This example is taken from 14.2 [temp.names] p5 template <class T> struct A { void f(int); template <class U> void f(U); }; template <class T> void f(T t) { A<T> a; a.template f<>(t); // OK: calls template a.template f(t); // error: not a template-id } G++ compiles it without error (as does Clang++, but not Comeau online)
I should have added an instantiation of the function to the code: template <class T> struct A { void f(int); template <class U> void f(U); }; template <class T> void f(T t) { A<T> a; a.template f<>(t); // OK: calls template a.template f(t); // error: not a template-id } int main() { f(1); }
Also present in 4.9 trunk, and I recently got a user complaint about this bug. How can I upvote? :)
Confirmed.
(In reply to Ville Voutilainen from comment #2) > Also present in 4.9 trunk, and I recently got a user complaint about this > bug. How can I upvote? :) If Bug 86315 is fixed, adding yourself on cc will become kinda like upvoting, so since you've already added yourself on cc, you've already upvoted.
G++ and Clang still accept this, EDG still rejects it.
(In reply to Eric Gallager from comment #4) > (In reply to Ville Voutilainen from comment #2) > > Also present in 4.9 trunk, and I recently got a user complaint about this > > bug. How can I upvote? :) > > If Bug 86315 is fixed, update: this has happened.
G++ and Clang still accept this, EDG doesn't. The example in [temp.names] is unchanged, so this should still be rejected.
This is CWG 96. Too late for GCC 10 but I'll take a look in GCC 11.
*** Bug 89978 has been marked as a duplicate of this bug. ***
*** Bug 96321 has been marked as a duplicate of this bug. ***
*** Bug 45975 has been marked as a duplicate of this bug. ***
*** Bug 113375 has been marked as a duplicate of this bug. ***