I am learning C++ templates using the resource listed here. In particular, read about template argument deduction. Now, after reading, to further clear up my concept of the topic I tried the following example that compiles in gcc but not in clang and msvc. Demo
template<typename T = int> void f()
{
}
template<typename T> void func(T)
{
}
int main()
{
func(f); //works in gcc but not in clang and msvc
func(f<>); //works in all
}
As we can see, the above example compiles fine in gcc but not in clang and msvc. My question is which compiler is right here according to the latest standard?