Create embedded-5_0-branch branch for development on ARM embedded cores.
[official-gcc.git] / embedded-5_0-branch / gcc / testsuite / g++.old-deja / g++.mike / p9732b.C
blobb10727ef371706ad9e43603067dba7220db22501
1 // { dg-do run  }
2 // prms-id: 9732
4 int count;
5 int bail = 0;
7 extern "C" void abort (void);
8 extern "C" void _exit (int);
11 struct base {
12   base () { ++count; }
13   ~base () { --count; }
14   base(const base&o) { ++count; }
17 class D {
18 public:
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;
35 base base_object;
37 base base_returning_function ();
39 const base& base_ref = base_returning_function ();
41 int main () {
44 base base_returning_function () {
45   base local_base_object;
46   return local_base_object;