template <typename T>
T go(T a, T *b){ T *t; return *t;}
int main() {
const int x = 10;
go(x, &x);
return 0;
}
Gives compiler error:
error: no matching function for call to ‘go(const int&, const int*)’
Why is the first argument a reference type const int& instead of just const int?
To fix this compilation error, I overrode the compiler deduction process by specifying the type of arguments go<const int>(x, &x);, but again why do I need to do that?