gcc/testsuite/g++.old-deja/g++.mike/p10148.C
raw| 1 | // { dg-do run } |
| 2 | // { dg-options "" } |
| 3 | // prms-id: 10148 |
| 4 | |
| 5 | int fail = 1; |
| 6 | void ok() { fail = 0; } |
| 7 | |
| 8 | class TC { |
| 9 | int s_; |
| 10 | }; |
| 11 | |
| 12 | class TIRD { |
| 13 | public: |
| 14 | void (*itc)(); |
| 15 | TIRD() { itc = ok; } |
| 16 | }; |
| 17 | |
| 18 | class TCCB : public TC, public TIRD { |
| 19 | }; |
| 20 | |
| 21 | class TCRCB : public TCCB { |
| 22 | public: |
| 23 | virtual void eat (); |
| 24 | }; |
| 25 | |
| 26 | void TCRCB::eat () { |
| 27 | void *vp = (void *)((TIRD*)this)->itc; |
| 28 | this->itc(); |
| 29 | } |
| 30 | |
| 31 | int main() { |
| 32 | TCRCB a; |
| 33 | a.eat(); |
| 34 | return fail; |
| 35 | } |