You do not need to say that you specialize twice.
Here you specialize in only one function template.
template<> void Foo<int>::fn<char>() {}
Live on coliru
template< typename T > struct Foo {}; template<> struct Foo< int > { template< typename T > void fn(); }; template<> void Foo<int>::fn<char>() {} int main() { Foo<int> f; f.fn<char>(); }
source share