Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.old-deja / g++.brendan / init3.C
blob751297eb389288968c5df436230cbe0b069df6dd
1 // { dg-do run  }
2 // GROUPS passed initialization
3 // p2766: Make sure that members are initialized in order of declaration
4 // in the class, not in order of specification in the mem-initializer list.
6 extern "C" int printf (const char *, ...);
7 extern "C" void exit (int);
9 int count = 0;
11 void die () { printf ("FAIL\n"); exit (1); }
13 class bar1 {
14 public:
15   bar1 (int) { if (count != 0) die (); count = 1; }
18 class bar2
20 public:
21   bar2 (int) { if (count != 1) die (); count = 2; }
24 class foo
26 public:
27   bar1 a;
28   bar2 b;
29   foo (int, int);
32 // bar1 should get built before bar2
33 foo::foo (int x, int y) : b(x), a(y) {}
35 int main()
37   foo f (1, 2);
38   printf ("PASS\n");