This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
qualified access to protected base class members does not work
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: qualified access to protected base class members does not work
- From: "Victor E. Kamensky" <victor dot kamensky at us dot matranet dot com>
- Date: Tue, 11 May 1999 19:27:14 -0700
- References: <926473745.9273.ezmlm@egcs.cygnus.com>
IMHO It is a bug. The following test program cannot be compiled while
I think it is a normal C++ program. If you remove "A::" qualifier it is
compiled and it works fine.
--------- inh.cpp ---------------------------------------
#include <stream.h>
class A
{
public:
void op1(int i) { cout << "A::op1(" << i << ")" << endl; };
};
class B:
protected A
{
};
class C:
virtual public B
{
};
class D:
virtual public B
{
};
class E:
public C,
public D
{
public:
void op2(int i) { A::op1(i); }
};
int main()
{
E * e = new E();
e -> op2(5);
};
-------------------------------------------------------------------
Egcs produces the following output:
inh.cpp: In method `void E::op2(int)':
inh.cpp:6: `void A::op1(int)' has protected accessibility
inh.cpp:31: within this context
-------------------------------------------------------------------
EGCS version: 1.1.2
g++ --version = "egcs-2.91.66"
bundled with RH 6.0, i586
Best Regards,
Victor Kamensky