#include <iostream>
struct Thing {
operator int() const { return 0; }
} thingy;
template <typename T>
void print(T l, T r) { std::cout << l << " " << r << "\n"; }
int main() {
int i = 0;
print(i, thingy);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IFRoaW5nIHsKCW9wZXJhdG9yIGludCgpIGNvbnN0IHsgcmV0dXJuIDA7IH0KfSB0aGluZ3k7Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4Kdm9pZCBwcmludChUIGwsIFQgcikgeyBzdGQ6OmNvdXQgPDwgbCA8PCAiICIgPDwgciA8PCAiXG4iOyB9CgppbnQgbWFpbigpIHsKCWludCBpID0gMDsKCXByaW50KGksIHRoaW5neSk7CglyZXR1cm4gMDsKfQ==
prog.cpp: In function ‘int main()’:
prog.cpp:12:17: error: no matching function for call to ‘print(int&, Thing&)’
print(i, thingy);
^
prog.cpp:12:17: note: candidate is:
prog.cpp:8:6: note: template<class T> void print(T, T)
void print(T l, T r) { std::cout << l << " " << r << "\n"; }
^
prog.cpp:8:6: note: template argument deduction/substitution failed:
prog.cpp:12:17: note: deduced conflicting types for parameter ‘T’ (‘int’ and ‘Thing’)
print(i, thingy);
^