This is the mail archive of the gcc@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]

Re: Question w.r.t. `'class Foo' has virtual functions but non-virtualdestructor` warning.


David Carlton <david.carlton@sun.com> writes:

| On Fri, 04 Mar 2005 19:15:41 -0600 (CST), Chris Lattner <sabre@nondot.org> said:
| 
| > It's not a matter of warning vs not warning: it's a matter of
| > emitting bogus warnings *sometimes* when you can emit the proper
| > warning *all of the time*.
| 
| I don't think you can emit the proper warning all of the time on
| destruction, either:
| 
| void deleteB( B *obj ) {
|   delete obj;
| }
| 
| If B is a base class with a non-virtual destructor, then this is safe
| if obj's dynamic type is B, unsafe otherwise.

That is correct; but the number of false positive is reduced --
significantly in case where those classes appear in header files.

-- Gaby


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