prog.cpp: In instantiation of 'void test1(const T&&) [with T = std::basic_string<char>]':
prog.cpp:20:24: required from here
prog.cpp:9:7: error: 'test2' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
test2(t);
^
prog.cpp:13:6: note: 'template<class T> void test2(const T&&)' declared here, later in the translation unit
void test2(const T &&t)
^
prog.cpp:9:7: error: cannot bind 'const std::basic_string<char>' lvalue to 'const std::basic_string<char>&&'
test2(t);
^
prog.cpp:13:6: note: initializing argument 1 of 'void test2(const T&&) [with T = std::basic_string<char>]'
void test2(const T &&t)
^