aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.bob/protected1.C
blob: ed8f77f6d37c089fcf1d22cae10b2f8ab57d904b (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
35
36
37
38
39
40
41
42
// { dg-do assemble  }
class A {
public:
  int i;
  A(int j) : i(j){}
};

class B : protected A {
public:
  B(int j) : A(j){}
  void f(){
    A k(*this);
  }
};

class C : protected B {
public:
  C(int j) : B(j){}
  void f();

  void g(){
    A k(i); 
  }
};


class D : public C {
public:
   D(int w) : C(i) {}
   void j() { A k(*this); }
   void h() { i=3; }
};

void C::f() {
   A k(*this);
}

B b(3);
int
main() {
 A *z = &b; // { dg-error "" } 
}