According to [temp.class.spec] 5/ (emphasis mine)
A class template partial specialization may be declared or redeclared in any namespace scope in which the corresponding primary template may be defined
This would suggest that partial specialization (just like in case of explicit specialization) have to appear in the namespace scope. This is actually confirmed by the example below the paragraph:
template<class T> struct A {
struct C {
template<class T2> struct B { };
};
};
// partial specialization of A<T>::C::B<T2>
template<class T> template<class T2>
struct A<T>::C::B<T2*> { };
//...
A<short>::C::B<int*> absip; // uses partial specialization
On the other hand C++ Standard Core Language Active Issues No 727 example suggests that in-class partial specialization is well formed:
struct A {
template<class T> struct B;
template <class T> struct B<T*> { }; // well-formed
template <> struct B<int*> { }; // ill-formed
};
I'm sure core issues document is correct here, but cannot find appropriate reference to confirm that. Can you help me?