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]

Using declarations with inheritance



	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
 --------------------------------------------------------------------





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