fork download
  1. // Example program
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. struct S
  7. {
  8. S()
  9. {
  10. cout << "ctor\n";
  11. }
  12. S(S&& rhs)
  13. {
  14. cout << "called move\n";
  15. }
  16. };
  17.  
  18. S goo()
  19. {
  20. S a;
  21. return a;
  22. }
  23.  
  24. int main()
  25. {
  26.  
  27. S&& goo();
  28. cout << "before construction\n";
  29. S a = goo();
  30.  
  31. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
before construction
ctor
called move