| 1 |
// { dg-do compile } |
| 2 |
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> |
| 3 |
// DR52: Non-static members, member selection and access checking |
| 4 |
|
| 5 |
struct A |
| 6 |
{ |
| 7 |
void foo(void); |
| 8 |
}; |
| 9 |
|
| 10 |
struct B |
| 11 |
{ |
| 12 |
private: |
| 13 |
void foo(void); |
| 14 |
}; |
| 15 |
|
| 16 |
struct B1 : B {}; |
| 17 |
struct B2 : B {}; |
| 18 |
|
| 19 |
struct C |
| 20 |
{ |
| 21 |
void foo(void); |
| 22 |
}; |
| 23 |
|
| 24 |
struct D : private C {}; // { dg-message "declared" } |
| 25 |
|
| 26 |
struct X: A, B1, B2, D |
| 27 |
{ |
| 28 |
public: |
| 29 |
void bar(void) |
| 30 |
{ |
| 31 |
this->B::foo(); // { dg-error "" } |
| 32 |
this->C::foo(); // { dg-error "inaccessible|context" } |
| 33 |
} |
| 34 |
}; |