inner class bug in g++

Mo DeJong mdejong@cygnus.com
Tue May 2 11:39:00 GMT 2000


Hello.

There seems to be a bug all versions of g++ related to
protected inner classes. Here is a small example.

class A {
   protected:
      class Ai { };
};
class B : public A::Ai { };

g++ compiles this without error, but others compilers correctly
reject the code.

eccp --strict kill.cc 
"kill.cc", line 6: error: class "A::Ai" is inaccessible
  class B : public A::Ai { };

Here is xlC (vacpp v5) says about this on AIX,
1540-0301: (S) The "protected" member "class A::Ai" cannot be accessed.

I hope that helps.
Mo Dejong
Red Hat Inc.



More information about the Gcc-bugs mailing list