fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Product
  5. {
  6. public:
  7. Product(const char *name, int i);
  8. Product(Product &&rhs) = delete;
  9. Product(const Product &rhs) = delete;
  10. ~Product();
  11. private:
  12. const char *m_name;
  13. int m_i;
  14. };
  15.  
  16. int main() {
  17. auto p = Product{"abc",123};
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:17:28: error: use of deleted function 'Product::Product(Product&&)'
  auto p = Product{"abc",123};
                            ^
prog.cpp:8:2: note: declared here
  Product(Product &&rhs) = delete;
  ^
stdout
Standard output is empty