fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Test
  5. {
  6. float one;
  7. float two;
  8. float three;
  9.  
  10. Test() { cout << "default ctor" << endl; }
  11. Test(const Test&) { cout << "copy ctor" << endl; }
  12. Test(Test&&) { cout << "move ctor" << endl; }
  13.  
  14. ~Test() { cout << "dtor" << endl; }
  15. };
  16.  
  17. Test MakeTest(bool branch)
  18. {
  19. Test handleOne, handleTwo;
  20. if (branch)
  21. return handleOne;
  22.  
  23. return handleTwo;
  24. }
  25.  
  26. int main() {
  27. Test help = MakeTest(false);
  28. return 0;
  29. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
default ctor
default ctor
move ctor
dtor
dtor
dtor