[Insight-developers] Mysterious "was hidden" warning

Mathieu Coursolle mcoursolle at rogue-research.com
Fri Aug 24 15:20:53 EDT 2007


Hi again ;)

Here is some post I received (thanks to Karel Zuiderveld) that explains what's
happening:

<http://groups.google.com/group/comp.lang.c++/browse_thread/thread/
7a50e69ee653eae2/1d5ca798c2d2e985?lnk=raot>

So a = operator is defined by the compiler, which hides the one in the
base class.

The proposed solution is then to specify the usage of the base class
operator = in all subclasses:

using itkTreeIteratorBase<TTreeType>::operator=;

Example:

template <class TTreeType>
class PreOrderTreeIterator : public TreeIteratorBase<TTreeType> 
{
public:

  using TreeIteratorBase<TTreeType>::operator=;

...
};

Any opposition?

Thanks.

Mathieu


>Hi ITK developpers,
>
>I am currently investigating on a repetitive warning we have on our
dashboard:
>
><http://www.itk.org/Testing/Sites/RogueResearch2/MacOSXTiger-univ/
>20070823-0100-Nightly/BuildWarning.html>
>
>Warning:
>
>/.../Insight/Code/Common/itkLeafTreeIterator.h: In instantiation of
>'itk::LeafTreeIterator<main(int, char**)::TreeType>':
>/.../Insight/Examples/DataRepresentation/Containers/TreeContainer.cxx:
>159:   instantiated from here
>/.../Insight/Code/Common/itkTreeIteratorBase.h:167: warning:
>'itk::TreeIteratorBase<TTreeType>& it
>k::TreeIteratorBase<TTreeType>::opera
>tor=(itk::TreeIteratorBase<TTreeType>&) [with TTreeType =
>itk::TreeContainer<main::NodeType>]' was hidden
>
>It comes from the = operator of itkTreeIteratorBase.h.
>
>From what I understand, the "was hidden" warning appears when a virtual
>function is not properly overwritten,
>and is instead overloaded.
>
>However, I can't find any reimplementation of the = operator in its
>subclasses, nor any redefinition of the Self paramter.
>
>If that operator is not virtual, there is no confusion between
>overwritten and overloaded, so the warning
>disappears.
>
>Questions:
>
>1) Does this operator needs to be virtual?
>
>2) Anyone knows why this warning appears?
>
>
>Thank you!
>
>Mathieu
>
>-- 
>____________________________________________________________
>Mathieu Coursolle                   mcoursolle at rogue-research.com
>Rogue Research                      www.rogue-research.com 
>Montréal, Québec, Canada
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers at itk.org
>http://www.itk.org/mailman/listinfo/insight-developers
>




More information about the Insight-developers mailing list