1 // { dg-do compile } 2 // Origin: Dirk Mueller <dmuell@gmx.net> 3 4 // PR c++/2739 5 // Access to base class private static member. 6 7 class Base { 8 private: 9 static int fooprivate; 10 protected: 11 static int fooprotected; 12 public: 13 static int foopublic; 14 }; 15 16 class Derived : public Base { 17 public: 18 void test(); 19 }; 20 21 int Base::fooprivate=42; // { dg-message "private" } 22 int Base::fooprotected=42; 23 int Base::foopublic=42; 24 test()25void Derived::test() { 26 if ( fooprivate ); // { dg-error "context" } 27 if ( fooprotected ); 28 if ( foopublic ); 29 } 30 main()31int main() 32 { 33 Derived d; 34 d.test(); 35 } 36