fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int&& move(int&& t) {
  5. return static_cast<int &&>(t);
  6. }
  7.  
  8. int main() {
  9. move(5) = 10;//why error?
  10.  
  11. return 0;
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:9:13: error: using xvalue (rvalue reference) as lvalue
     move(5) = 10;//why error? 
             ^
stdout
Standard output is empty