2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / other / access2.C
blobc7dd77a043aefb7d51c898a3a2fd2cc49fb78757
1 // { dg-do compile }
2 // Origin: Dirk Mueller <dmuell@gmx.net>
4 // PR c++/2739
5 // Access to base class private static member.
7 class Base {
8 private:
9   static int fooprivate;
10 protected:
11   static int fooprotected;
12 public:
13   static int foopublic;
16 class Derived : public Base {
17 public:
18   void test();
21 int Base::fooprivate=42;        // { dg-error "private" }
22 int Base::fooprotected=42;
23 int Base::foopublic=42;
25 void Derived::test() {
26   if ( fooprivate );            // { dg-error "context" }
27   if ( fooprotected );
28   if ( foopublic );
31 int main()
33   Derived d;
34   d.test();