[osg-users] Virtual base initialization issues

Robert Osfield robert.osfield at gmail.com
Thu Jun 30 01:29:11 PDT 2016


Hi Stuart,

This warning is a bit of pain.  Fix this warning and you generate a
warning with other compilers depending upon which compiler and warning
options enabled.  We had a discussion and attempted to fix some of
these warnings in the last dev release cycle.

Robert.

On 30 June 2016 at 06:08, Stuart Mentzer <Stuart_Mentzer at objexx.com> wrote:
> Hello,
>
> Visual C++ 2015 finds a problem (in current master) with the initialization
> of virtual base classes in the constructors of the hierarchies including
> Object, Callback, NodeCallback, GUIEventHandler, EventHandler,
> CameraManipulator, StandardManipulator, and AnimationManagerBase.
> Constructors are attempting to initialize virtual bases Object and Callback
> from classes that are not the most-derived, concrete class so those
> initializations are being ignored. It doesn't help (or look right) that
> multiple levels in the hierarchy attempt (and fail) to initialize these
> virtual bases.
>
> An example of the reported warnings is:
> C:\Projects\OSG\OpenSceneGraph\src\osgGA\CameraManipulator.cpp(24): warning
> C4589: Constructor of abstract class 'osgGA::CameraManipulator' ignores
> initializer for virtual base class 'osg::Object'
> C:\Projects\OSG\OpenSceneGraph\src\osgGA\CameraManipulator.cpp(24): note:
> virtual base classes are only initialized by the most-derived type
> C:\Projects\OSG\OpenSceneGraph\src\osgGA\CameraManipulator.cpp(25): warning
> C4589: Constructor of abstract class 'osgGA::CameraManipulator' ignores
> initializer for virtual base class 'osg::Callback'
> C:\Projects\OSG\OpenSceneGraph\src\osgGA\CameraManipulator.cpp(25): note:
> virtual base classes are only initialized by the most-derived type
>
> In some cases I see the most-derived classes also do the (correct) virtual
> base initialization but it looks like at least these 2 are missing it:
> BasicAnimationManager::BasicAnimationManager(const AnimationManagerBase& b,
> const osg::CopyOp& copyop)
> TimelineAnimationManager::TimelineAnimationManager(const
> TimelineAnimationManager& nc,const osg::CopyOp& co)
>
> I don't know enough of the internals to say if this could be causing
> problems in practice but it would be good to fix this usage. I'm willing to
> take a shot at it if that would be helpful.
>
> Stuart
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list