Problem with class proteced class member.

Alexander Zvyagin zvyagin@gams.ihep.su
Sat Sep 4 02:34:00 GMT 1999


Dear GCC developers,

Here is the code:

#include <vector.h>
class A { protected: vector<A> a; };
class B: public A { void f(void); };
void B::f(void)
{
  a[0];    // fine
  a[0].a;  // error!
}

And here is the problem (it should not exist):
$ g++ -c 2.c
2.c: In method `void B::f()':
2.c:2: `class vector<A,allocator<A> > A::a' is protected
2.c:7: within this context

I use gcc version 2.95.1 19990816 (release).

With best wishes,
Alexander Zvyagin.



More information about the Gcc-bugs mailing list