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]

Re: egcs C++ bug


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


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