This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: list <T>::iterator _it ; fails to compile


On Fri, Aug 13, 2004 at 01:54:48PM +0100, Jonathan Wakely wrote:

> On Fri, Aug 13, 2004 at 02:36:01PM +0200, Arnaud Gardelein wrote:
> 
> > Hello !
> > 
> >   It seems that when I try to create a list iterator in a template class
> > with "list<T>::iterator _it ;", gcc-3.4.0 does not like that, whereas
> > version 3.2.2 does (compilation details follows) :
> > 
> > gcc-3.4.0 :
> > test.cpp:9: error: expected `;' before "_it"
> > 
> > gcc-3.2.2 :
> > test.cpp:9: warning: `typename std::list<T, std::allocator<_CharT>
> > >::iterator' is implicitly a typename
> > test.cpp:9: warning: implicit typename is deprecated, please see the
> > documentation for details
> > 
> >   What's wrong ?
> 
> GCC 3.3.2 tells you what's wrong with the code and tells you to check
> the docs to understand it.  If you'd fixed the code to remove the
> warning it would have made it compile with 3.4
> 
> The implicit typename feature that was deprecated in 3.3 was removed
> from 3.4, so the code is no longer accepted.
> 
> You need to say "typename" before referring to a type that is dependent
> on a template parameter, to tell the compiler that the name refers to
> a type and not something else (such as a variable or a function).

Sorry for the rather angry-sounding reply, I'm having a bad day!

This page says that the feature has been deprecated, although doesn't
really give a lot of help understanding it if you don't know what it
means:
http://gcc.gnu.org/onlinedocs/gcc-3.3.3/gcc/Deprecated-Features.html#Deprecated%20Features

You basically have to say
    typename std::list<T, std::allocator<_CharT> > > >::iterator
not
    std::list<T, std::allocator<_CharT> > > >::iterator

jon

-- 
"There is no governor anywhere. You are all absolutely free."
	- Cagliostro the Great
	  "The Schroedinger's Cat Trilogy" RAW


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]