fork download
  1. #include <utility>
  2. #include <memory>
  3.  
  4. struct object {
  5. ~object() {}
  6. object() {}
  7. object(int) {}
  8. object(object const&) {}
  9. object(object&&) {}
  10.  
  11. template <typename T>
  12. object& operator=(T&& from) {
  13. // ...
  14. return *this;
  15. }
  16. };
  17.  
  18.  
  19. int main() {
  20. object o;
  21. object const p;
  22. o = p;
  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:22:7: error: use of deleted function ‘constexpr object& object::operator=(const object&)’
   o = p;
       ^
prog.cpp:4:8: note: ‘constexpr object& object::operator=(const object&)’ is implicitly declared as deleted because ‘object’ declares a move constructor or move assignment operator
 struct object {
        ^~~~~~
stdout
Standard output is empty