fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct WhatHappendsHere{
  5. int foo;
  6. ~WhatHappendsHere(){
  7. cout << "dtor: " << foo << endl;
  8. }
  9. };
  10.  
  11. int main() {
  12. WhatHappendsHere a = {1};
  13. {
  14. WhatHappendsHere b = {2};
  15. b = a;
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
dtor: 1
dtor: 1