summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tc1/dr52.C
blob: 4f4015dc958dd91be517153002d2c787fa85a7a3 (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
33
34
// { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR52: Non-static members, member selection and access checking

struct A 
{
  void foo(void);
};

struct B
{
private:
  void foo(void);
};

struct B1 : B {};
struct B2 : B {};

struct C
{ // { dg-error "C" }
  void foo(void);
};

struct D : private C {};

struct X: A, B1, B2, D
{
public:
  void bar(void)
  {
    this->B::foo();  // { dg-error "" }
    this->C::foo();  // { dg-error "inaccessible|context" }
  }
};