fork(1) download
  1. #include <iostream>
  2.  
  3. class A{
  4. public:
  5. A(){}
  6. explicit A(const A &other){ std::cout << "Copy\n";}
  7. ~A(){}
  8.  
  9. A &operator= (const A &other){
  10. std::cout << "Assign\n";
  11. return *this;
  12. }
  13. };
  14.  
  15.  
  16. int main() {
  17. A foo;
  18. A bar = foo;
  19. bar = foo;
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 3468KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:18:10: error: no matching function for call to 'A::A(A&)'
  A bar = foo;
          ^
prog.cpp:5:2: note: candidate: A::A()
  A(){}
  ^
prog.cpp:5:2: note:   candidate expects 0 arguments, 1 provided
stdout
Standard output is empty