public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11624] New: -Wnon-virtual-dtor doesn't always work
@ 2003-07-21 21:10 bangerth at dealii dot org
  2003-07-23 21:01 ` [Bug c++/11624] " pinskia at physics dot uc dot edu
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2003-07-21 21:10 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: -Wnon-virtual-dtor doesn't always work
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org,gdr at gcc dot gnu dot
                    org

I just closed a PR that had essentially this code:
------------------------------------
struct A
{
  virtual void afunc () {};
};

struct B
{
  virtual void bfunc () {};
};

struct C : A, B
{};

int main (void)
{
  B * Bptr = new C();
  delete Bptr;
}
----------------------------
What was wrong with that PR is immaterial here, but one of the things
is that the submitter didn't recognize that he should have a virtual
destructor. That's what we have -Wnon-virtual-dtor for, I thought, since
it says:
-----------------------------------
@item -Wnon-virtual-dtor @r{(C++ only)}
@opindex Wnon-virtual-dtor
Warn when a class appears to be polymorphic, thereby requiring a virtual
destructor, yet it declares a non-virtual one.
This warning is enabled by @option{-Wall}.
-----------------------------------

Alas, this option doesn't trigger on above code, for no version after 3.2.
(I don't have an older version on my present system, so can't check.) I
think it should, though, shouldn't it?

W.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-07-29 21:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-21 21:10 [Bug c++/11624] New: -Wnon-virtual-dtor doesn't always work bangerth at dealii dot org
2003-07-23 21:01 ` [Bug c++/11624] " pinskia at physics dot uc dot edu
2003-08-04 20:41 ` pinskia at physics dot uc dot edu
2004-01-03 13:33 ` pinskia at gcc dot gnu dot org
2004-01-03 13:36 ` pinskia at gcc dot gnu dot org
2004-09-28 23:58 ` mrs at apple dot com
2005-03-19 21:05 ` pinskia at gcc dot gnu dot org
2005-03-19 21:07 ` pinskia at gcc dot gnu dot org
2005-07-29 21:15 ` pinskia at gcc dot gnu dot 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).