------- Comment #1 from redi at gcc dot gnu dot org 2009-11-12 13:24 ------- It should fail to compile because you are specializing a template which was never declared, not because it is ambiguous.
namespace { template<> void foo<int>(void) { return; } } That is a specialization, but there is no matching primary template. This fails due to ambiguous overloads: template<typename> void foo(void); template<> void foo<int>(void); namespace { template<class> void foo(void) { return; } } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42018