The following code generates the error /home/stefan/fs.cc:11: error: template-id ‘foo<>’ for ‘void foo(int)’ does not match any template declaration /home/stefan/fs.cc:11: error: invalid function declaration as it doesn't seem to match 'Tag<int>::tag' against 'Tag<A>::tag' but the substituted 'int' directly. --- template <typename A> struct Tag { typedef int type;}; template <typename A> void foo(typename Tag<A>::type t); template <> void foo(Tag<int>::type t) {} ---
Confirmed not a regression, I saw a bug that was related to this was recently filed also.
PR 26261 was the bug which I was thinking of.
For the record, Comeau also rejects it.
It's only a diagnostic problem: the template type 'int' in Tag<int>::type is non-deductible, so the compiler can't find the primary template. The code in therefore in fact invalid. You can make it valid by explicitly specifying the template argument as in template <> void foo<int>(Tag<int>::type t) {} Once one knows what the problem is, the error message even makes some sense. I don't know how to improve it, since the compiler certainly can't tell that the primary template uses a template parameter in a non-deducible context here. W.