#include <iostream> class A{ public: A(){} explicit A(const A &other){ std::cout << "Copy\n";} ~A(){} A &operator= (const A &other){ std::cout << "Assign\n"; return *this; }}; int main() { A foo; A bar = foo; bar = foo; return 0;}
Standard input is empty
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
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!