[Bug c++/55836] New: Weffc++: warning: base class 'class std::list<int, std::allocator<int> >' has a non-virtual destructor
hamren at sdu dot se
gcc-bugzilla@gcc.gnu.org
Mon Dec 31 23:22:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55836
Bug #: 55836
Summary: Weffc++: warning: base class 'class std::list<int,
std::allocator<int> >' has a non-virtual destructor
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hamren@sdu.se
Created attachment 29066
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29066
Self-contained source file
When using -Weffc++ with this code
class Foo : public std::list<int> { };
the compiler warns that the base class "has a non-virtual destructor". While
this is true, there is not much one can do about it.
Suggestions: either remove the warning in these cases (when the problem is in
the standard library), or add virtual destructors to standard library classes.
If the compiler were to set a pre-processor variable when -Weffc++ is in
effect, adding virtual destructors could be made conditional.
/Lars Hamrén
More information about the Gcc-bugs
mailing list