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++/55836] Weffc++: warning: base class 'class std::list<int, std::allocator<int> >' has a non-virtual destructor


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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-01 01:30:50 UTC ---
(In reply to comment #0)
> 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.

There are two things you can do:

1) don't use -Weffc++, it's flawed in many ways and noone's forcing you to use
it

2) don't use public derivation from classes without virtual destructors, the
warning is telling you about a potential problem. If you can't change the base
class, take the hint and don't derive from it.


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