This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: egcs C++ bug
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Re: egcs C++ bug
- From: Ross Smith <ross dot s at ihug dot co dot nz>
- Date: Fri, 02 Jul 1999 08:49:32 +1300
- Organization: The Internet Group
- References: <000001bebb11$4fc37400$2df0dad4@micromata.de>
Roger Rene Kommer wrote:
>
> Look at the very simple code in CompilerTest.cpp.
> I'm quite sure, that this is legal code.
> I've also tested in on the linux plattform (same version of egcs) with the
> same result.
> class A {
> public:
> void foo(double d) { }
> };
>
> class C : public A {
> public:
> void foo(char* c) { }
> };
>
> int main() {
> C c;
> c.foo(1.2);
> return 0;
> }
The compiler is right. Functions in a derived class hide functions in a
parent class with the same name but different signatures. I'd be the
first to agree that this is a misfeature, but that's the way C++ works.
--
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
The good news, according to the FCC, is that television viewing won't be
interrupted by the Y2K problem. The bad news, according to the rest of
us, is that television viewing won't be interrupted by the Y2K problem.
-- Jonathan Erickson in Dr Dobb's Journal