fork download
  1. #include <iostream>
  2.  
  3. struct C
  4. {
  5. int x = 1;
  6.  
  7. C()
  8. {
  9. }
  10.  
  11. C(C&&)
  12. {
  13. }
  14. };
  15.  
  16. int main()
  17. {
  18. const C c;
  19. C c2(c);
  20.  
  21. std::cout << c.x << " " << c2.x << std::endl;
  22.  
  23. return 0;
  24. }
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 'constexpr C::C(const C&)'
     C c2(c);
           ^
prog.cpp:3:8: note: 'constexpr C::C(const C&)' is implicitly declared as deleted because 'C' declares a move constructor or move assignment operator
 struct C
        ^
stdout
Standard output is empty