[Insight-developers] Annoying GCC Warning: Implicit typename deprecated?

Julien Jomier jjomier@cs.unc.edu
Wed, 23 Apr 2003 18:22:59 -0400


Hi Kent,

I think the best way is to declare:

typedef BlobSpatialObject<> Superclass;
typedef typename Superclass::ChildrenListType ChildrenListType; 

in itkROIStrandSpatialObject.h

And use ChildrenListType *points = this->GetChildren();

if ChildrenListType is not defined in BlobSpatialObject, you can just add
it.

Let me know if this works.

Julien

> -----Original Message-----
> From: insight-developers-admin@public.kitware.com 
> [mailto:insight-developers-admin@public.kitware.com] On 
> Behalf Of Kent Williams
> Sent: Wednesday, April 23, 2003 6:12 PM
> To: Insight Developers List
> Subject: [Insight-developers] Annoying GCC Warning: Implicit 
> typename deprecated?
> 
> 
> Well I'm working on some stuff that I've not checked in yet, 
> and I'm running 
> into this petty annoyance from GCC:
> 
> .../SpatialObject/itkROIStrandSpatialObject.txx:30: warning: 
> implicit  
> typename is deprecated, please see the documentation for details
> 
> Now I can shut that up most of the time by putting a 
> 'typename' keyword in 
> front of the offending type, but their are odd cases when 
> doing so generates a compiler error with g++ 3.2.2.
> 
> For example, my ROIStrandSpatialObject<unsigned Int 
> TDimension> derives from itk::BlobSpatialObject.  I need to 
> iterate thru the list returned by 
> this->SpatialObject::GetChildren(), so in a member function I have
> 
> 1: ChildrenListType *points = this->GetChildren();
> 
> where ChildrenListType is defined in SpatialObject:
> 
> typedef std::list< Self * > ChildrenListType; 
> 
> Line XXX generates the 'implicit typename is deprecated' 
> error, and adding 
> typename in front of ChildrenListType generates a compiler 
> error. If I do 
> this:
> 
> typename SpatialObject<TDimension>::ChildrenListType *points = 
> this->GetChildren();
> 
> Then the compiler shuts up. I have more convoluted cases in 
> which I seem not 
> to be able get the warning to go away without throwing a 
> compile error. I guess what I'm asking is for a C++ Minor 
> Diety among you who can point me to 
> some sort of documentation that will tell me how to properly 
> deal with this 
> error, or some guidance on whether to worry about it.
> 
> 
> 
> 
> 
> _______________________________________________
> Insight-developers mailing list Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>