This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
-Woverloaded-virtual flag
- From: "Schumacher, Gordon" <gordon_schumacher at maxtor dot com>
- To: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
- Cc: "Eike, Randal" <Randal_Eike at maxtor dot com>
- Date: Wed, 7 Aug 2002 14:48:57 -0600
- Subject: -Woverloaded-virtual flag
So... I'm getting warnings generated from the following code:
class A
{
virtual A* foo()
{var++; return this;}
virtual A* foo(int16 idx)
{return NULL;}
};
class B: public A
{
virtual A* foo(int16 idx)
{return new B(base + idx);}
}
Warning: `virtual A* A::foo()' hidden
Warning: by `virtual A* B::foo(short int)'
If my understanding is correct, this should not be a warning at all - both
forms of this function are defined in the parent class, so the base function
should not be hidden!
Am I confused on this? I've also tried it without the "virtual" on class
B's function declaration.
Thanks!