| 1 |
// { dg-do run } |
| 2 |
// PRMS Id: 4697 |
| 3 |
// Bug: g++ calls the non-const method for a const object. |
| 4 |
|
| 5 |
class A { |
| 6 |
public: |
| 7 |
void foo(int &i) const { i = 0; } |
| 8 |
void foo(int &i) { i = 1; } |
| 9 |
}; |
| 10 |
|
| 11 |
int main() |
| 12 |
{ |
| 13 |
A a; |
| 14 |
const A& b = a; |
| 15 |
int i = 2; |
| 16 |
b.foo (i); |
| 17 |
return i; |
| 18 |
} |