gcc/testsuite/g++.old-deja/g++.mike/net39.C
raw| 1 | // { dg-do run } |
| 2 | void *vp; |
| 3 | |
| 4 | class silly { |
| 5 | public: |
| 6 | virtual int b() { return 1; } |
| 7 | }; |
| 8 | class solly : silly { |
| 9 | public: |
| 10 | virtual int b() { return 2; } |
| 11 | }; |
| 12 | class thing { |
| 13 | public: |
| 14 | virtual int a() { return 3; } |
| 15 | }; |
| 16 | class thong : public solly, public thing { |
| 17 | public: |
| 18 | virtual int a() { |
| 19 | if (this != vp) return 4; |
| 20 | else return 0; |
| 21 | } |
| 22 | }; |
| 23 | |
| 24 | typedef int(thing::*ping)(); |
| 25 | ping qq = &thing::a; |
| 26 | |
| 27 | int main() { |
| 28 | thong b; |
| 29 | vp = &b; |
| 30 | return (b.*qq)(); |
| 31 | } |