This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[repeated] Error accessing protected member


Hi,

I didn't get any responce for my previous bug report, so I
repeat it because error remains in 971023 snapshot. Please,
let me know if I'm wrong or if you take control of the situation.

Compiling the following code with egcs-971016 (and egcs-971023):
-----------------------------------------
class A
{
protected:
  void f(){}
};

class B :
  public A
{
int c;
};

class C :
  virtual public B
{
protected:
  void f() { A::f(); }
};

void main ()
{
C x;
}
------------------------------
I get the following error message:
------------------------------
tmp.C: In method `void C::f()':
tmp.C:4: `void A::f()' is protected
tmp.C:17: within this context
-------------------------------
(This code is localized from OmniBroker 2.0b4, so it works
fine with most of C++ compilers and gcc-2.7.2 too)
Removing "virtual" all works fine. Virtuality of A->B inheritance
doesn't affect to compilation result.
I didn't find anything in new C++ draft that can explain such effect,
so it seems like egcs bug.

Andrey Slepuhin,
Moscow State University


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]