Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / g++.old-deja / g++.mike / p789a.C
blobbee0228bb20b9b37aed4f8289d87fa12eb1ee4bc
1 // { dg-do run  }
2 // global and local multidimensional array objects are not getting
3 // constructors called on any dimension, other than the first.  Also,
4 // the destructors are not being called.  Seems odd, they probably
5 // used to work. :-(
6 // prms-id: 789
8 extern "C" int printf (const char *, ...);
9 struct foo
11   static int count;
12   void print (int i, int j) { printf ("foo[%d][%d] = %d\n", i, j, x); }
13   int x;
14   foo () {
15     x = count++;
16     printf("this %d = %x\n", x, (void *)this);
17   }
18   virtual ~foo () {
19     printf("this %d = %x\n", x, (void *)this);
20     --count;
21   }
23 int foo::count;
26 int main ()
28   {
29     foo array[3][3];
30     for (int i = 0; i < 3; i++)
31       {
32         for (int j = 0; j < 3; j++)
33           {
34             printf("&a[%d][%d] = %x\n", i, j, (void *)&array[i][j]);
35           }
36       }
37       // The count should be nine, if not, fail the test.
38       if (foo::count != 9)
39         return 1;
40   }
41   if (foo::count != 0)
42     return 1;
43   return 0;