fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct X { ~X() { cout << "X dies" << endl; } };
  5.  
  6. const X& x() { X x; return x; }
  7.  
  8. int main() {
  9. const X& xx = x();
  10. cout << "Did X die yet?" << endl;
  11. (void)xx;
  12. // your code goes here
  13. return 0;
  14. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
X dies
Did X die yet?