fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. class Foo
  5. {
  6. public:
  7. Foo() { cout << "cstr" << this << endl; }
  8. ~Foo() { cout << "dstr" << this << endl; }
  9.  
  10. };
  11. Foo get()
  12. {
  13. /*auto named = Foo();
  14.   return named;*/
  15. return Foo();
  16. }
  17. int main() {
  18.  
  19. //Foo& f = get();
  20. const Foo& f = get();
  21. cout << "after function call" << &f << endl;
  22. return 0;
  23. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
cstr0xff94b48f
after function call0xff94b48f
dstr0xff94b48f