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 definitely undefined behaviour. The user might have forgotten to define the destructor, so the warning would draw their attention to it. For example: struct abc { virtual void f() = 0; }; struct interface : abc { virtual ~interface(); }; void f(abc* p) { delete p; } The intended use might be to destroy such objects through a pointer to interface, but f() has been defined to take the wrong type. >> + bool abstract = false; >> + for (x = TYPE_METHODS (type); x; x = DECL_CHAIN (x)) >> + if (DECL_PURE_VIRTUAL_P (x)) >> + { >> + abstract = true; >> + break; >> + } >> + if (abstract) > > Just check CLASSTYPE_PURE_VIRTUALS. Thanks, I'll retest with that change ...