Weird "protected within this context"

Dmitrij Tejblum dima@tejblum.dnttm.rssi.ru
Sat Jan 17 11:39:00 GMT 1998


EGCS release 1.0 cannot compile following code:

class A {
protected:
	int f(int);
};

class B: public A {
};

class C: virtual public B {
public:
	int f(int x);
};

int C::f(int x){
	return A::f(x+4)+5;
}


It give this message:

q.cc: In method `int C::f(int)':
q.cc:3: `int A::f(int)' is protected
q.cc:15: within this context

GCC 2.7.2.1 give same error.  "Any other C++ compiler in the world" can 
compile such code... And I don't understand what can be wrong with this 
example.

Thanks.
Dima





More information about the Gcc-bugs mailing list