fork download
  1. struct notcopyable
  2. {
  3. public:
  4. notcopyable() {}
  5. private:
  6. notcopyable(const notcopyable& other) {}
  7. };
  8. class A : notcopyable
  9. {
  10. };
  11.  
  12. int main()
  13. {
  14. A a;
  15. A b(a);
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:7: error: base class 'notcopyable' has private copy constructor
class A : notcopyable
      ^
prog.cpp:6:2: note: declared private here
        notcopyable(const notcopyable& other) {}
        ^
prog.cpp:15:4: note: implicit copy constructor for 'A' first required here
        A b(a);
          ^
1 error generated.
stdout
Standard output is empty