------- Comment #10 from s dot franke at bebbosoft dot de 2010-03-05 07:06 ------- this is an example from the official C++ Standard which should be used as test case, "11.2 Accessibility of base classes and base class members":
class B { public: int mi; // nonstatic member static int si; // static member }; class D : private B { }; class DD : public D { void f(); }; void DD::f() { mi = 3; // error: mi is private in D si = 3; // error: si is private in D B b; b.mi = 3; // OK (b.mi is different from this->mi) b.si = 3; // OK (b.si is different from this->si) B::si = 3; // OK B* bp1 = this; // error: B is a private base class B* bp2 = (B*)this; // OK with cast bp2->mi = 3; // OK: access through a pointer to B. } If you comment out the erranous lines gcc still complains with: > error: `class B' is inaccessible -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20397