Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.law/visibility20.C

raw
1 // { dg-do assemble }
2 // GROUPS passed visibility
3 // visibility file
4 // From: [email protected] (Douglas Scott)
5 // Date: Tue, 10 Aug 93 10:06:33 PDT
6 // Subject: G++ 2.4.5 allows access to protected base members
7 // Message-ID: <[email protected]>
8
9 class Base {
10 protected:
11 void protectedBaseFunction() {} // { dg-message "" } protected
12 public:
13 Base() {}
14 };
15
16
17 class Derived : public Base {
18 public:
19 Derived() {}
20 void noticeThisFunction(Base *);
21 };
22
23
24 void
25 Derived::noticeThisFunction(Base *b) {
26 b->protectedBaseFunction(); // ARM says this is not allowed// { dg-error "" } .*
27 // since it is not called on 'this'
28 }
29
30 int main() {
31 Base b;
32 Derived d;
33 d.noticeThisFunction(&b);
34 printf("gpptest run\n");// { dg-error "5:'printf' was not declared" } .*
35 }
36