fork download
  1. #include <iostream>
  2. struct foo { ~foo() { std::cout << "destroying!\n"; } };
  3. const foo& func(const foo& a, const foo&) { return a; }
  4.  
  5. int main()
  6. {
  7. foo x;
  8. const foo& y = func(foo(), x);
  9. std::cout << "main\n";
  10. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
destroying!
main
destroying!