public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31397]  New: Useful compiler warning missing (virtual functions in derived classes used without 'virtual')
@ 2007-03-30  9:49 Thomas dot Lange at sun dot com
  2007-03-30 23:43 ` [Bug c++/31397] " fang at csl dot cornell dot edu
                   ` (11 more replies)
  0 siblings, 12 replies; 18+ messages in thread
From: Thomas dot Lange at sun dot com @ 2007-03-30  9:49 UTC (permalink / raw)
  To: gcc-bugs

When trying to build the OOo code warning-free we turned all useful warnings on
and get rid of them.
But there is one warning that would be really useful missing. It is not
required for code correctness or safety at all, but it would be most useful to
have better understandable code.

What I/we at OOo would like to have is a warning when a when a function in a
derived class is overloaded without specifing 'virtual'. 

This would allow to identify all the cases where this is missing and in the end
it would be clear just be looking at the specific declaration of a class which
functions are virtual and which not. Right now in our sometimes very old code
it is quite troublesome to always go up in the class hierarchy in order to
check this.

Example:
class A
{
  A();
  virtual ~A();
  virtual int f( int x );
};

class B : public A
{
  B( int y );
  ~B();
  int f( int x );
};

It would be nice if there would be warnings for ~B and f not using the
'virtual' keyword. Together with the switch to treat warnings as errors this
would help to produce better understandable code.


-- 
           Summary: Useful compiler warning missing (virtual functions in
                    derived classes used without 'virtual')
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas dot Lange at sun dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31397


^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <bug-31397-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-08-11 23:48 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-30  9:49 [Bug c++/31397] New: Useful compiler warning missing (virtual functions in derived classes used without 'virtual') Thomas dot Lange at sun dot com
2007-03-30 23:43 ` [Bug c++/31397] " fang at csl dot cornell dot edu
2007-04-07 23:58 ` bangerth at dealii dot org
2009-07-08 10:23 ` Thomas dot Lange at sun dot com
2009-07-08 10:30 ` Thomas dot Lange at sun dot com
2009-07-13 11:48 ` jwakely dot gcc at gmail dot com
2009-07-13 11:57 ` Thomas dot Lange at sun dot com
2009-07-13 12:00 ` rguenth at gcc dot gnu dot org
2009-07-13 12:02 ` Thomas dot Lange at sun dot com
2009-07-13 12:07 ` Thomas dot Lange at sun dot com
2009-07-13 16:47 ` jwakely dot gcc at gmail dot com
2009-07-21 10:51 ` jwakely dot gcc at gmail dot com
2009-08-11 14:16 ` jwakely dot gcc at gmail dot com
     [not found] <bug-31397-4@http.gcc.gnu.org/bugzilla/>
2011-06-21 16:13 ` redi at gcc dot gnu.org
2011-07-09 12:55 ` ville.voutilainen at gmail dot com
2013-05-22  8:20 ` ethouris at gmail dot com
2015-01-06  2:05 ` tbsaunde at gcc dot gnu.org
2021-08-11 23:48 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).