// g++(5.4)
void func(int * const &) {}
void func(int *) {}
template <typename T> void tfunc(const T &) {}
template <typename T> void tfunc(T *) {}
int main()
{
int a = 0;
func(&a); // ambiguous
tfunc(&a); // unambiguous
return 0;
}
According to my another test, tfunc(&a)
instantiates the first template to void tfunc(int * const &)
which has the same parameter type as the first nontemplate.
So, why is the first call ambiguous but the second not?