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: Bug: Failure to compile legal code (gcc-2.95.2)


> 
> Hi Mike,
> 
> Alexandre Oliva gave you the right answer.  In your example, the
> declaration of B::operator<<(int) does indeed hide A::operator<<(const
> char*).  The fact that it is a virtual method means nothing.
> 
> In ISO C++, you are suppose to be able to do this:
> 
> [...]
> 
> class B : public A
> {
> public:
> 
>   using A::operator<<;
>   virtual A& operator<<(int);
> };
> 
> [...]
> 
> to ensure that overloading works as you had expected.  However, 2.95.2
> doesn't implement that form of using.  g++ 3.0 gets this right.
> 
> If you really want to understand why this works this way, see _The
> Design and Evolution of C++_. pg 76.  I'm sure that other great tomes
> from Stroustrup reveal this information as well.

I will have to check this out. This seems so counter-intuitive to me.
Thanks for the clarification.

/Mike


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