This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c++/53596] g++-4.7 -Wall shouldn't complain for non-virtual protected dtor


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

--- Comment #4 from kim.walisch at gmail dot com 2012-06-07 08:28:05 UTC ---
I found another post on the web
(http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110530/042333.html)
that explains the warning, it says:

"If Derived (see above) gets subclassed in the future, deletion in "main()"
will be undefined behavior. Ideally Derived should be marked "final" and then
there will also be no warning"

Based on this explanation I think the warning is valid. Clang's warning message
is somewhat more clear:

"warning: delete called on 'Derived' that has virtual functions but non-virtual
destructor [-Wdelete-non-virtual-dtor]"

This also explains why there is no warning in test2.cpp of my previous post.


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