This compiles:
struct type{};
template<typename T>
void foo(T in) { bar(in, type()); }
void bar(int, const type&) {}
int main() { foo(42); }
And this does not (as I learned in my previous question from today):
template<typename T>
void foo(T in) { bar(in); }
void bar(int) {}
int main() { foo(42); }
Is the reason the first snippet compiles also explained with ADL? If so, how?
The template parameter is a fundamental type and ADL is not supposed to work for it... Why does using the type type
make any difference?