fork download
  1. #include <iostream>
  2.  
  3. struct Test
  4. {
  5. Test(Test const &) = delete;
  6. Test(Test &&) = delete;
  7. Test &operator=(Test const &) = delete;
  8. Test &operator=(Test &&) = delete;
  9.  
  10. Test(int &x)
  11. {
  12. ++x;
  13. }
  14. };
  15.  
  16. int main()
  17. {
  18. int x = 6;
  19. Test t = x;
  20. std::cout << x << std::endl;
  21. }
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:19:11: error: use of deleted function ‘Test::Test(Test&&)’
  Test t = x;
           ^
prog.cpp:6:2: error: declared here
  Test(Test &&) = delete;
  ^
stdout
Standard output is empty