Using declarations with inheritance
Theodore Papadopoulo
Theodore.Papadopoulo@sophia.inria.fr
Tue Oct 20 09:00:00 GMT 1998
I almost sure this is already known, but just in case...
The following program (excerpted from The C++ Programming langage 3rd
Edition) does not compile....
class A {
public:
int f(int);
char f(char);
};
class B {
public:
double f(double);
};
class AB: public A, public B {
public:
using A::f;
using B::f;
char f(char);
AB f(AB);
};
void g(AB& ab)
{
ab.f(1);
ab.f('a');
ab.f(2.0);
ab.f(ab);
}
mururoa->eg++ -c -g Bug5.C
Bug5.C:20: cannot adjust access to `char A::f(char)' in `class AB'
Bug5.C:19: because of local method `class AB AB::f(class AB)' with same name
Bug5.C:20: cannot adjust access to `double B::f(double)' in `class AB'
Bug5.C:19: because of local method `class AB AB::f(class AB)' with same name
This is egcs-1.1 but a recent snapshot (last friday) shows the same behaviour.
Unless I'm wrong and this code should not compile, the error message could be
changed to say "Not yet implemented"....
Thank's a lot,
Theo.
--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------
More information about the Gcc-bugs
mailing list