class A
{
public:
  int i;
  class A1
  {
    int j;
  };
};

class B : private A
{
public:
  A::i;
  A::A1;
};

void
f ()
{
  B b;
  b.i = 1;
  B::A1 a1;
}

The above program does not compile with the following messages:
t.cpp:15: error: declaration does not declare anything
t.cpp: In function ‘void f()’:
t.cpp:6: error: ‘class A::A1’ is inaccessible
t.cpp:23: error: within this context

The C++ standard section 11.3 talks about access declarators. It does not
explicitly say that inner classes can be used this way, but nor does it say
they cannot. Note that the integer `i' works fine with the same idiom.


-- 
           Summary: access declarations don't work for classes
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andrew dot stubbs at st dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29138

Reply via email to