On 21/11/2011 10:07, Lars Gullik Bjønnes wrote:
 André Pönitz <andre.poen...@mathematik.tu-chemnitz.de> writes:

 | On Sun, Nov 20, 2011 at 11:46:10PM +0100, Lars Gullik Bjønnes
 wrote:
>>
>> Even if gcc 4.7 has not been released (quite far from), it might
>> be nice to test compile with it anyway.
>
 | Sure. |
>> Here are the results:
>>
>> GuiWorkArea.cpp: In destructor ‘virtual
>> lyx::frontend::GuiWorkArea::~GuiWorkArea()’:
>> GuiWorkArea.cpp:327:9: warning: deleting object of polymorphic
>> class type ‘lyx::frontend::GuiWorkArea::Private’ which has
>> non-virtual destructor might cause undefined behaviour
>> [-Wdelete-non-virtual-dtor]

GuiWorkArea::Private is not at all polymorphic...

 | I see " : d(new Private)" and "delete d;". Where is the problem?

 The (potential) problem is a destructor in a parent class that is
 not marked virtual. If anything is allocated in the that class it
 will not be destroyed through the polymorfic pointer.

 It might very well be that gcc is a tad mistaken, but if
 EmbeddedWorkArea, then GuiWorkArea should have a virtual destructor.

GuiWorkArea inherits from WorkArea which already has a virtual dtor.

 (I cannot see how GuiWorkArea::Private plays into this.)

Me neither... I say gcc is mixing up things :-)
Is it for trunk? If yes, maybe gcc is mislead by the fact that GuiWorkArea is forward declared in GuiWorkArea_Private.h.
Do you still have the warning if you "#include GuiWorkArea.h"?

Abdel.


Reply via email to