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