template<typename T>
void foo(T&& x, T y) {
}
int main() {
int x;
foo(x,x);
return 0;
}
dGVtcGxhdGU8dHlwZW5hbWUgVD4Kdm9pZCBmb28oVCYmIHgsIFQgeSkgewp9CgppbnQgbWFpbigpIHsKCWludCB4OwoJZm9vKHgseCk7CglyZXR1cm4gMDsKfQ==
prog.cpp: In function ‘int main()’:
prog.cpp:7:9: error: no matching function for call to ‘foo(int&, int&)’
foo(x,x);
^
prog.cpp:7:9: note: candidate is:
prog.cpp:2:6: note: template<class T> void foo(T&&, T)
void foo(T&& x, T y) {
^
prog.cpp:2:6: note: template argument deduction/substitution failed:
prog.cpp:7:9: note: deduced conflicting types for parameter ‘T’ (‘int&’ and ‘int’)
foo(x,x);
^