http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58140
Bug ID: 58140
Summary: -Wnon-virtual-dtor shouldn't fire for classes declared
final
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tudorb at fb dot com
Created attachment 30636
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30636&action=edit
Test case
In C++11, we can declare a class as "final" to indicate that it can't be
derived from. In that case, having a public non-virtual destructor is fine,
even if the class has virtual methods (no derived classes exist, so deleting an
instance via a pointer is always safe).
In the attached example, the warning should fire for NonFinalDerived, but not
for FinalDerived.