summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/pmf8.C
blob: 10f67c6f00f0b862bf969149115adf4d3581a0b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// { dg-do run  }
int fail;

class A *ptr_a;

class A {
public:
  char space1[24];
  virtual void foo() {
    if (this != ptr_a)
      fail = 1;
  }
};

class Space {
  char space2[36];
};

class B : public Space, public A {
} b;

void (B::*pmf1)() = &A::foo;
void (A::*pmf2)() = &A::foo;

int main() {
  ptr_a = &b;
  (b .* (void (B::*) ()) &A::foo) ();
  (b .* pmf1) ();
  (b .* pmf2) ();
  (b .* &A::foo) ();
  return fail;
}