------- Comment #2 from redi at gcc dot gnu dot org 2009-11-12 13:28 ------- This fails:
template<typename> void foo(void); template<> void foo<int>(void); namespace { template<> void foo<int>(void) { return; } } int main(int, char **) { foo<int>(); } ttt.cc:6: error: specialization of 'template<class> void foo()' in different namespace ttt.cc:2: error: from definition of 'template<class> void foo()' But if a valid specialization already exists, the one in the anon namespace is not rejected. That's a bug. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42018