fork(4) download
  1. #include <iostream>
  2.  
  3. struct something
  4. {
  5. ~something() { std::cout << "dtor" << std::endl; }
  6. something& func() { return *this; }
  7. const something& func() const { return *this; }
  8. };
  9.  
  10.  
  11.  
  12. int main()
  13. {
  14. auto& r = something().func();
  15.  
  16. std::cout << "==main==" << std::endl;
  17. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
dtor
==main==