This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
overloaded virtual function warnings
- To: egcs at egcs dot cygnus dot com
- Subject: overloaded virtual function warnings
- From: Nathan Sidwell <nathan at acm dot org>
- Date: Fri, 05 Feb 1999 17:31:39 +0000
- Organization: University of Bristol
- Reply-To: nathan at compsci dot bristol dot ac dot uk
Hi,
g++ has the -Woverloaded-virtual flag to warn about derrived member functions
which match the name but not signature of a base virtual member function. Do
you thing it desirable for this flag to also warn in the following two
instances?
struct A
{
virtual int foo();
int baz();
};
struct B : A
{
int foo(); \\ implicitly virtual
virtual int baz(); \\ not virtual in base
};
The language states B::foo must be virtual, but the programmer's not explicitly
stated so - simple perusal of B's definition would not pick that up. B::baz is
weirder -- I think it's more likely to be a programmer error than intentional.
(Can anyone think of a legitimate reason for doing that?)
Comments? I'll implement it if feedback is non-negative.
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
You can up the bandwidth, but you can't up the speed of light
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk