https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63705
Bug ID: 63705 Summary: [4.8/4.9/5 Regression] function template specialization outside namespace rejected with C++11 Product: gcc Version: 5.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: trippels at gcc dot gnu.org Please consider: markus@x4 ~ % cat te.ii namespace N { template <typename T1> void f (const T1) {} } template <> void N::f (const int) {} markus@x4 ~ % clang++ -std=c++11 -c te.ii markus@x4 ~ % icpc -std=c++11 -c te.ii markus@x4 ~ % g++ -std=c++11 -c te.ii te.ii:10:16: error: specialization of ‘template<class T1> void N::f(T1)’ in different namespace [-fpermissive] N::f (const int) {} ^ te.ii:5:1: error: from definition of ‘template<class T1> void N::f(T1)’ [-fpermissive] f (const T1) {} ^ markus@x4 ~ % clang++ -c te.ii te.ii:10:4: warning: first declaration of function template specialization of 'f' outside namespace 'N' is a C++11 extension [-Wc++11-extensions] N::f (const int) {} ^ te.ii:5:1: note: explicitly specialized declaration is here f (const T1) {}