https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111608
--- Comment #4 from Julien Bernard <raplonu.jb at gmail dot com> --- (In reply to Jonathan Wakely from comment #3) I wasn't sure how to describe this issue, so my last sentence was probably incorrect. > I suspect this is covered by [temp.point] p7: > > "If two different points of instantiation give a template specialization > different meanings according to the one-definition rule (6.3), the program > is ill-formed, no diagnostic required." If I take this example: // 1. primary template template<typename T> struct X { int f() { return 1; } }; // 2. partial template specialization template<typename T> struct X<T*> { int f() {return 2; } }; // 3. full template specialization template<> struct X<int*> { int f() { return 3; } }; This program is well formed. In addition, the above 3. full template specialization is equivalent to the following 4. implicit instantiation in the sense they produce the same program (please, correct me if I'm wrong): // 4. implicit instantiation template<> int X<int*>::f() { return 3; } If I move 3. between 1. and 2., it still compiles but won't when 4. is between 1. and 2. Here is a live demo with gcc, clang and msvc as a simple point of comparison. https://godbolt.org/z/36aceTTb5