I was trying to explicitly specialize a member function template when i noticed that one such case(given below) compiles fine in clang and msvc but not in gcc. Here is the link for the verification of the same: https://godbolt.org/z/15z4nT5Kx
struct C
{
template<typename T>
void f()
{
}
template<> void f<int>()
{
}
};
int main()
{
return 0;
}
As can be seen in the above link clang and msvc compiles the program without any problem but gcc says:
<source>:10:14: error: explicit specialization in non-namespace scope 'struct C'
10 | template<> void f<int>()
| ^
<source>:10:21: error: template-id 'f<int>' in declaration of primary template
10 | template<> void f<int>()
| ^~~~~~
Which compiler is right here?