gcc/testsuite/g++.old-deja/g++.other/overload8.C
raw| 1 | // { dg-do run } |
| 2 | class a { |
| 3 | public: |
| 4 | int f() { return 0; } |
| 5 | int f() const { return 1; } |
| 6 | }; |
| 7 | |
| 8 | class b : public a { |
| 9 | }; |
| 10 | |
| 11 | int main() |
| 12 | { |
| 13 | int (b::* ptr1)() = &b::f; |
| 14 | int (b::* ptr2)() const = &b::f; |
| 15 | |
| 16 | b ao; |
| 17 | |
| 18 | if ((ao.*ptr1)() != 0) |
| 19 | return 1; |
| 20 | if ((ao.*ptr2)() != 1) |
| 21 | return 1; |
| 22 | } |
| 23 |