fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. void foo(std::vector<int>&& v) {
  6.  
  7.  
  8. }
  9.  
  10. int main() {
  11. std::vector<int> v;
  12.  
  13. foo(v),
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13:6: error: cannot bind rvalue reference of type ‘std::vector<int>&&’ to lvalue of type ‘std::vector<int>’
  foo(v),
      ^
prog.cpp:5:6: note:   initializing argument 1 of ‘void foo(std::vector<int>&&)’
 void foo(std::vector<int>&& v) {
      ^~~
prog.cpp:14:2: error: expected primary-expression before ‘return’
  return 0;
  ^~~~~~
stdout
Standard output is empty