namespace A { namespace B { template < typename T > void foo(); } } struct S1; struct S2;
namespace A { namespace B { template <> void foo< S1 >(); // accepted } } template <> void A::B::foo< S2 >(); // rejected $ g++ bug.cpp -c -Wall error: specialization of ‘template<class T> void A::B::foo()’ in different namespace error: from definition of ‘template<class T> void A::B::foo()’ this testcase works with g++ 3.3.6 and vs-2003. -- Summary: reject [valid?] template specialization. Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net GCC build triplet: * GCC host triplet: * GCC target triplet: * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26782