7cff847023fe5e90f12e13766aef60704b1c43f6
[gcc.git] / gcc / testsuite / g++.dg / tc1 / dr52.C
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 { // { dg-message "declared" }
21 void foo(void);
22 };
23
24 struct D : private C {};
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 };