See the following code:
namespace ns { template <typename T> void func() {} } template <> void ns::func<int>() {} int main() {}
While clang 3.6 (C ++ 14) compiles fine, GCC 5.2 (C ++ 14) produces the following error
main.cpp:9:20: error: specialization of 'template<class T> void ns::func()' in different namespace [-fpermissive] void ns::func<int>() {} ^ main.cpp:4:6: error: from definition of 'template<class T> void ns::func()' [-fpermissive] void func() {} ^
So what does the standard say about this? Who is right?
source share