fork download
  1.  
  2. #include<memory>
  3.  
  4. struct A {
  5. std::auto_ptr<int> i;
  6. };
  7.  
  8. A F() {
  9. A a;
  10. return a;
  11. }
  12.  
  13. int main(int argc, char **argv) {
  14. A a = F();
  15. return 0;
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main(int, char**)’:
prog.cpp:14:13: error: no matching function for call to ‘A::A(A)’
     A a = F();
             ^
prog.cpp:14:13: note: candidates are:
prog.cpp:4:8: note: A::A()
 struct A {
        ^
prog.cpp:4:8: note:   candidate expects 0 arguments, 1 provided
prog.cpp:4:8: note: A::A(A&)
prog.cpp:4:8: note:   no known conversion for argument 1 from ‘A’ to ‘A&’
stdout
Standard output is empty