On 4 June 2011 16:49, Jason Merrill wrote:
> On 06/04/2011 08:45 AM, Jonathan Wakely wrote:
>>
>> + if (CLASSTYPE_PURE_VIRTUALS (type))
>> + warning(OPT_Wdelete_non_virtual_dtor,
>> + "deleting object of abstract class type %qT"
>> +
On 06/04/2011 08:45 AM, Jonathan Wakely wrote:
+ if (CLASSTYPE_PURE_VIRTUALS (type))
+ warning(OPT_Wdelete_non_virtual_dtor,
+ "deleting object of abstract class type %qT"
+ " which has non-virtual destructor"
+
New patch using CLASSTYPE_PURE_VIRTUALS, thanks for that.
Bootstrapped and tested again on x86_64-linux, no regressions.
ChangeLogs as before, OK for trunk?
Index: c-family/c.opt
===
--- c-family/c.opt (revision 174624)
+++ c-fa
On 06/03/2011 04:20 AM, Jonathan Wakely wrote:
On 3 June 2011 02:55, Jason Merrill wrote:
Do we really want to warn about the case where the class has no/trivial
destructor?
I think so. Definitely if it's an abstract class, since it's
definitely undefined behaviour. The user might have for
On 3 June 2011 02:55, Jason Merrill wrote:
> On 06/02/2011 06:02 PM, Jonathan Wakely wrote:
>>
>> + if (!dtor || !DECL_VINDEX (dtor))
>
> Do we really want to warn about the case where the class has no/trivial
> destructor?
I think so. Definitely if it's an abstract class, since it's
On 06/02/2011 06:02 PM, Jonathan Wakely wrote:
+ if (!dtor || !DECL_VINDEX (dtor))
Do we really want to warn about the case where the class has no/trivial
destructor?
+ bool abstract = false;
+ for (x = TYPE_METHODS (type); x; x = DECL_CHAIN (x))
On 2 June 2011 22:27, Jonathan Wakely wrote:
> -Wnon-virtual-dtor isn't always what you want, defining a polymorphic
> object without a virtual destructor is not necessarily a mistake. You
> may never delete such an object so instead of warning when the class
> is defined it's more useful to warn o
-Wnon-virtual-dtor isn't always what you want, defining a polymorphic
object without a virtual destructor is not necessarily a mistake. You
may never delete such an object so instead of warning when the class
is defined it's more useful to warn only when the class is deleted, as
Clang does with -Wd