blob: c49f4dd20d34b7ba3e3eb3a2c52534977c7d68e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR142: Injection-related errors in access example
class B { // { dg-error "inaccessible" }
public:
int mi; // { dg-error "inaccessible" }
static int si; // { dg-error "inaccessible" }
};
class D: private B {
};
class DD: public D {
void f();
};
void DD::f() {
mi = 3; // { dg-error "within this context" "" }
si = 3; // { dg-error "within this context" "" }
::B b;
b.mi = 3;
b.si = 3;
::B::si = 3;
::B* bp1 = this; // { dg-error "inaccessible base" "" }
::B* bp2 = (::B*)this;
bp2->mi = 3;
B b2; // { dg-error "within this context" "" }
B::si = 3; // { dg-error "within this context" "" }
}
|