Protected members of a base class are accessible in derived class if nested too deeply:
class base_t { protected: unsigned x; union { unsigned y; struct { unsigned z; }; }; }; class child_t : public base_t { public: void foo () { base_t base; base.x = 0; // access denied (ok) base.y = 0; // access denied (ok) base.z = 0; // access permitted (not ok) }; }; compiling the above produces the following output: In member function `void child_t::foo()': 4: error: `unsigned int base_t::x' is protected 19: error: within this context 6: error: `unsigned int base_t::<anonymous union>::y' is protected 20: error: within this context -- Summary: Access control fails on nested protected base member Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stefan dot gotz at intel dot com GCC build triplet: i686-linux-gnu GCC host triplet: i686-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30097