2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.law / arm15.C
blob11a3036e0ba80a02326091122c0a0857fea507f8
1 // { dg-do run  }
2 // GROUPS passed ARM-compliance
3 // arm file
4 // From: Johan Bengtsson <jbn@lulea.trab.se>
5 // Date:     Thu, 21 Oct 93 16:10:25 +0100
6 // Subject:  gcc 2.4.5 initializes base classes in mem-initializer order
7 // Message-ID: <9310211510.AA14943@holden.lulea.trab.se>
9 #include <stdio.h>
10 #include <stdlib.h>
12 int state = 0;
14 class A { public:
15         A() { 
16                 if (state == 0)
17                         state = 1;
18                 else {
19                         printf ("FAIL\n");
20                         exit (1);
21                 }
22         }
25 class B { public:
26         B() {
27                 if (state == 1)
28                         state = 2;
29                 else {
30                         printf ("FAIL\n");
31                         exit (1);
32                 }
33         }
36 class AB : public A, public B { public:
37         AB() : B(), A() { 
38                 if (state == 2)
39                         state = 3;
40                 else {
41                         printf ("FAIL\n");
42                         exit (1);
43                 }
44         }
47 int main()
49         AB ab;
50         if (state == 3)
51                 printf("PASS\n");
52         else
53                 printf("FAIL\n");
54         exit (state != 3);