OSDN Git Service

Initial revision
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.mike / pmf8.C
1 int fail;
2
3 class A *ptr_a;
4
5 class A {
6 public:
7   char space1[24];
8   virtual void foo() {
9     if (this != ptr_a)
10       fail = 1;
11   }
12 };
13
14 class Space {
15   char space2[36];
16 };
17
18 class B : public Space, public A {
19 } b;
20
21 void (B::*pmf1)() = &A::foo;
22 void (A::*pmf2)() = &A::foo;
23
24 int main() {
25   ptr_a = &b;
26   (b .* (void (B::*) ()) &A::foo) ();
27   (b .* pmf1) ();
28   (b .* pmf2) ();
29   (b .* &A::foo) ();
30   return fail;
31 }