fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A {
  5. public:
  6. A() {}
  7. explicit A(const A& a) { cout << "copy!\n"; }
  8. };
  9.  
  10. A GetA()
  11. {
  12. A a = A();
  13. A result = a;
  14. return result;
  15. }
  16.  
  17. int main()
  18. {
  19. A b = GetA();
  20. A* x = &b;
  21. A y = *x;
  22. A z = b;
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'A GetA()':
prog.cpp:12: error: no matching function for call to 'A::A(A)'
prog.cpp:13: error: no matching function for call to 'A::A(A&)'
prog.cpp:14: error: no matching function for call to 'A::A(A&)'
prog.cpp: In function 'int main()':
prog.cpp:19: error: no matching function for call to 'A::A(A)'
prog.cpp:21: error: no matching function for call to 'A::A(A&)'
prog.cpp:22: error: no matching function for call to 'A::A(A&)'
stdout
Standard output is empty