#include <iostream> using namespace std; template<class T> void only_rvals(T&) = delete; template<class T> void only_rvals(T&&) { } int main() { int i; only_rvals(i); only_rvals(6); }
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:12:17: error: call of overloaded ‘only_rvals(int&)’ is ambiguous only_rvals(i); ^ prog.cpp:12:17: note: candidates are: prog.cpp:5:6: note: void only_rvals(T&) [with T = int] <deleted> void only_rvals(T&) = delete; ^ prog.cpp:8:6: note: void only_rvals(T&&) [with T = int&] void only_rvals(T&&) { } ^
Standard output is empty