1 // { dg-do assemble } 2 // GROUPS passed visibility 3 // visibility file 4 // From: doug@foxtrot.ccmrc.ucsb.edu (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: <9308101706.AA04485@foxtrot.ccmrc.ucsb.edu> 8 9 class Base { 10 protected: protectedBaseFunction()11 void protectedBaseFunction() {} // { dg-message "" } protected 12 public: Base()13 Base() {} 14 }; 15 16 17 class Derived : public Base { 18 public: Derived()19 Derived() {} 20 void noticeThisFunction(Base *); 21 }; 22 23 24 void noticeThisFunction(Base * b)25Derived::noticeThisFunction(Base *b) { 26 b->protectedBaseFunction(); // ARM says this is not allowed// { dg-error "" } .* 27 // since it is not called on 'this' 28 } 29 main()30int 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 37