fork(2) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. template<class T>
  7. void test1(const T &&t)
  8. {
  9. test2(t);
  10. }
  11.  
  12. template<class T>
  13. void test2(const T &&t)
  14. {
  15. return;
  16. }
  17.  
  18. int main (void)
  19. {
  20. test1(std::string{" "});
  21.  
  22. return 0;
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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)
      ^
stdout
Standard output is empty