Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.mike/pmf8.C

raw
1 // { dg-do run }
2 int fail;
3
4 class A *ptr_a;
5
6 class A {
7 public:
8 char space1[24];
9 virtual void foo() {
10 if (this != ptr_a)
11 fail = 1;
12 }
13 };
14
15 class Space {
16 char space2[36];
17 };
18
19 class B : public Space, public A {
20 } b;
21
22 void (B::*pmf1)() = &A::foo;
23 void (A::*pmf2)() = &A::foo;
24
25 int main() {
26 ptr_a = &b;
27 (b .* (void (B::*) ()) &A::foo) ();
28 (b .* pmf1) ();
29 (b .* pmf2) ();
30 (b .* &A::foo) ();
31 return fail;
32 }