FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.mike / p5571.C
blobec350eacb3a090730cb2529856365aab374c6482
1 // prms-id: 5571
3 int err = 0;
4 void *vp = 0;
6 class ParentOne {
7 public:
8   ParentOne() {};
9 #ifdef MAKE_WORK
10   virtual ~ParentOne() {};
11 #endif
12 private:
13   char SomeData[101];
16 class ParentTwo {
17 public:
18   ParentTwo() {};
19   virtual ~ParentTwo() {};
20 private:
21   int MoreData[12];
22   virtual int foo() { return 0; }
25 struct Child : public ParentOne, public ParentTwo {
26     int ChildsToy;
27     virtual void PrintThis() = 0;
30 struct Student : public Child {
31   int StudentsBook;
32   void PrintThis() {
33     if (vp == 0)
34       vp = (void *)this;
35     else
36       {
37         if (vp != (void *)this)
38           ++err;
39       }
40   }
41   void LocalPrintThis() {
42     if (vp == 0)
43       vp = (void *)this;
44     else
45       {
46         if (vp != (void *)this)
47           ++err;
48       }
49     PrintThis();
50   }
51   void ForcedPrintThis() {
52     if (vp == 0)
53       vp = (void *)this;
54     else
55       {
56         if (vp != (void *)this)
57           ++err;
58       }
59     Student::PrintThis();
60   }
63 int main() {
64   Student  o;
65   o.LocalPrintThis();
66   o.ForcedPrintThis();
67   Child* pX = &o;
68   pX->PrintThis();
69   return err;