gcc/testsuite/g++.old-deja/g++.mike/p10849a.C
raw| 1 | // { dg-do run } |
| 2 | // prms-id: 10849 |
| 3 | |
| 4 | struct A |
| 5 | { |
| 6 | int comm; |
| 7 | A(int i) : comm(i) { } |
| 8 | }; |
| 9 | |
| 10 | struct S1 { char c1; }; |
| 11 | |
| 12 | struct B : public S1, public A |
| 13 | { |
| 14 | B(int i) : A(i) { } |
| 15 | }; |
| 16 | |
| 17 | struct C : public A |
| 18 | { |
| 19 | C(int i) : A(i) { } |
| 20 | }; |
| 21 | |
| 22 | struct D : public B, public C |
| 23 | { |
| 24 | virtual int g() { |
| 25 | int D::*pmd = (int C::*)&C::comm; |
| 26 | return (this->*pmd) == 42; |
| 27 | } |
| 28 | D() : B(41), C(42) { } |
| 29 | } d; |
| 30 | |
| 31 | int main() { |
| 32 | if (! d.g()) |
| 33 | return 1; |
| 34 | } |