summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/visibility16.C
blob: e4b3bf854a275f75b8a15a50ee455f4c47e8a71e (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
// { dg-do assemble  }
// GROUPS passed visibility
// visibility file
// From: Marie Trapp <Marie.Trapp@analog.com>
// Date:     Thu, 5 Aug 93 11:55:15 EDT
// Subject:  access of protected members
// Message-ID: <9308051553.AA07639@nwd2sun1.analog.com>
class A {
  protected:
    int astuff; // { dg-error "" } protected
    A() {
        astuff = 3; 
    }
};

class B : public A {
    int bstuff;
  public:
    B( A *p) {
        bstuff = p->astuff;// { dg-error "" } .*
    }
};

class C : public A {
    int cstuff;
  public:
    C() {
        cstuff = 5;
    }
};

int main() {
    C cvar;
    B bvar(&cvar);
}