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