fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Test {
  5. Test() {
  6. cout << "Ctor" << endl;
  7. };
  8. ~Test() {
  9. cout << "Dtor" << endl;
  10. }
  11. };
  12. Test& get_test() {
  13. Test test;
  14. return test;
  15. }
  16. int main() {
  17. const Test &test = get_test();
  18. cout << "Use" << endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
Ctor
Dtor
Use