[Bug c++/7302] -Wnon-virtual-dtor should't complain of protected dtor

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 2 21:30:00 GMT 2011


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

--- Comment #26 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-02 21:29:53 UTC ---
(can this bug be un-ASSIGNED?)

(In reply to comment #25)
> Here, H must have a virtual destructor. The point where it can know it should
> warn is the "delete this;" line.

I've posted a patch to http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00191.html
which gives this for the code in comment 25

7302.cc:16:12: warning: deleting object of abstract class type ‘H’ which has
non-virtual destructor will cause undefined behaviour
[-Wdelete-non-virtual-dtor]



More information about the Gcc-bugs mailing list