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.

Reply via email to