The following should not compile: struct c { private:struct n { int j; }; };
struct d:public c { void f (struct n *p); }; According to 9.2 ; 1, nested types are class members. 11 ; 4 says that member access control does not affect visibility, only access. If an inaccessible member name is used, the program is ill-formed. FWIW, g++ will also accept if you declare a data member of type struct n in d. -- Summary: missing access control checks in subclasses for nested types Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: amylaar at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29040