1// { dg-do run } 2// prms-id: 9732 3 4int count; 5int bail = 0; 6 7extern "C" void abort (void); 8extern "C" void _exit (int); 9 10 11struct base { 12 base () { ++count; } 13 ~base () { --count; } 14 base(const base&o) { ++count; } 15}; 16 17class D { 18public: 19 ~D() { 20 if (bail++) 21 { 22 // On some Linux boxes, we run the dtor for d twice, 23 // once before exit, and once after! 24 abort (); 25 } 26 else 27 { 28 if (count != 0) 29 _exit (1); 30 _exit (0); 31 } 32 } 33} d; 34 35base base_object; 36 37base base_returning_function (); 38 39const base& base_ref = base_returning_function (); 40 41int main () { 42} 43 44base base_returning_function () { 45 base local_base_object; 46 return local_base_object; 47} 48