fork download
  1. #include <stdio.h>
  2.  
  3. class Test
  4. {
  5. public:
  6.  
  7. Test()
  8. {
  9. puts("Test()\r\n");
  10. }
  11.  
  12. Test(const Test&)
  13. {
  14. puts("Test(const Test&)\r\n");
  15. }
  16.  
  17. Test(Test&&)
  18. {
  19. puts("Test(Test&&)\r\n");
  20. }
  21. };
  22.  
  23. static Test GetTest(bool x)
  24. {
  25. if (x)
  26. {
  27. return Test();
  28. }
  29. else
  30. {
  31. Test temp;
  32. return temp;
  33. }
  34. }
  35.  
  36. int main()
  37. {
  38. Test t1;
  39. Test t2(t1);
  40. Test t3 = GetTest(true);
  41. Test t4 = GetTest(false);
  42. return 0;
  43. }
  44.  
Success #stdin #stdout 0s 4260KB
stdin
Standard input is empty
stdout
Test()

Test(const Test&)

Test()

Test()

Test(Test&&)