[Bug c++/29040] New: missing access control checks in subclasses for nested types

amylaar at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Sep 12 20:03:00 GMT 2006


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



More information about the Gcc-bugs mailing list