This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Weird "protected within this context"
- To: egcs-bugs at cygnus dot com
- Subject: Weird "protected within this context"
- From: Dmitrij Tejblum <dima at tejblum dot dnttm dot rssi dot ru>
- Date: Sat, 17 Jan 1998 22:15:51 +0300
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