On Mon, 2015-01-12 at 18:50 +0000, Gordon Sim wrote:
> On 01/12/2015 06:00 PM, Chuck Rolke wrote:
> > Visual Studio 2010 x64 generates five new warnings compiling LossyLvq code.
> > The code may be correct and the compiler is known to warn on correct code.
> > That said, if the code could be reorganized to avoid the warnings maybe
> > Coverity would stop complaining as well.
>
> [...]
>
> > 3>C:\Program Files (x86)\Microsoft Visual Studio
> > 10.0\VC\include\memory(931):
> > warning C4150: deletion of pointer to incomplete type
> > 'qpid::broker::MessageMap'; no destructor called
> > 3>
> > D:\Users\crolke\git\rh-qpid\qpid\cpp\src\qpid/broker/QueueCursor.h(65) :
> > see declaration of 'qpid::broker::MessageMap'
> > 3> C:\Program Files (x86)\Microsoft Visual Studio
> > 10.0\VC\include\memory(930) : while compiling class template member
> > function 'std::auto_ptr<_Ty>::~auto_ptr(void)'
> > 3> with
> > 3> [
> > 3> _Ty=qpid::broker::MessageMap
> > 3> ]
> > 3> ..\..\cpp\src\qpid\broker\LossyLvq.cpp(27) : see reference to
> > class template instantiation 'std::auto_ptr<_Ty>' being compiled
> > 3> with
> > 3> [
> > 3> _Ty=qpid::broker::MessageMap
> > 3> ]
> > 3> QueueFactory.cpp
>
> That one seems fair, and I've checked in what I believe is a fix for that.
>
> > 3>D:\Users\crolke\git\rh-qpid\qpid\cpp\src\qpid/broker/LossyLvq.h(38):
> > warning C4250: 'qpid::broker::LossyLvq' : inherits
> > 'qpid::broker::Lvq::qpid::broker::Lvq::push' via dominance
> > 3> D:\Users\crolke\git\rh-qpid\qpid\cpp\src\qpid/broker/Lvq.h(39)
> > : see declaration of 'qpid::broker::Lvq::push'
> >
> > 3>D:\Users\crolke\git\rh-qpid\qpid\cpp\src\qpid/broker/LossyLvq.h(38):
> > warning C4250: 'qpid::broker::LossyLvq' : inherits
> > 'qpid::broker::LossyQueue::qpid::broker::LosQueue::checkDepth' via dominance
> > 3>
> > D:\Users\crolke\git\rh-qpid\qpid\cpp\src\qpid/broker/LossyQueue.h(36) : see
> > declaration of 'qpid::broker::LossyQueue::checkDepth'
>
> Those are exactly the methods I expect to be inherited. LossyQueue
> alters the implementation of checkDepth() to support the 'ring'
> behaviour, Lvq alters the implementation of push() to support the lvq
> behaviour. What I wanted was a Queue type that inherited both these
> behaviours. To me, this is exactly the use case virtual inheritance was
> intended for.
>
> I could of course organise the code so as not to need to use virtual
> inheritance, but I'd rather only do that if there was a good reason.
> With respect to the last two warnings above, does the attached patch
> resolve them? (This overrides both methods in the most derived class and
> explicitly chooses the implementation to use).
No need to override, just put
using LossyQueue::checkDepth;
using Lvq:push;
in your declaration. That "copies" the desired base-name into your class
name-space without declaring a new function. This is one of the rare
occasions involving inheritance where C++ actually does what you expect.
It's a pity (but not entirely unjustified) that VC++ assumes you are
probably confused anyway :)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]