This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug: Failure to compile legal code (gcc-2.95.2)
- To: mharrold at cas dot org
- Subject: Re: Bug: Failure to compile legal code (gcc-2.95.2)
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- Date: Wed, 17 Jan 2001 08:59:45 -0600 (CST)
- CC: gcc-bugs at gcc dot gnu dot org
- Reply-to: rittle at rsch dot comm dot mot dot com
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.
Regards,
Loren