The following code compiles with gcc and clang.
template <typename T> struct identity { typedef T type; }; template <typename T> void foo(typename identity<T>::type); template <typename T> void foo(T); int main() { foo<int>(0); }
It seems that overload resolution selects the first overload ( identity<T>::type one).
Can someone explain why overloads are not ambiguous? As far as I can tell, the only difference between the two is that the argument of the first is not the context to be deduced, and the argument of the second is not, but since I provide the argument of the template explicitly, I donβt understand why this matters.
Highcommander4
source share