This is the mail archive of the gcc@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]

overloaded virtual function warnings


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


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