Boost logo

Boost :

Subject: Re: [boost] Official warnings policy?
From: Kim Barrett (kab.conundrums_at_[hidden])
Date: 2009-11-05 18:46:10


On Nov 5, 2009, at 5:32 PM, Emil Dotchevski wrote:

> On Thu, Nov 5, 2009 at 1:50 PM, Kim Barrett <kab.conundrums_at_[hidden]
> > wrote:
>>
>> On Nov 5, 2009, at 2:04 PM, Emil Dotchevski wrote:
>>>
>>> - non-virtual-dtor on GCC contradicts a valid design choice.
>>
>> At least in recent versions of gcc, this warning is not generated
>> when there
>> is a non-public dtor.
>
> This doesn't help much. [...] but it will complain in the derived
> class, which typically doesn't even define a destructor explicitly.

Yeah, the problem here is that there's no (easy?) way to indicate that
the derived class is intended to be a leaf class. On the other hand,
once one has paid the cost of making a class polymorphic anyway, is
there really much (if any?) benefit to making its destructor non-
virtual?

Note that there's a related warning turned on by -Weffc++, namely:
"Make destructors virtual in base classes."
This one warns if a class with a non-virtual dtor is used as a base
class. It triggers regardless of the accessibility of that dtor. That
pretty clearly warns about perfectly safe and sensible code.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk