This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: bug in g++.3.0.1 for std::list::const_iterator with -pedantic
- To: gilles civario <civario at ceng dot cea dot fr>
- Subject: Re: bug in g++.3.0.1 for std::list::const_iterator with -pedantic
- From: Richard Sandiford <rsandifo at redhat dot com>
- Date: 24 Sep 2001 16:55:40 +0100
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <3BAF41D2.8A7054AA@ceng.cea.fr>
gilles civario <civario@ceng.cea.fr> writes:
> The file foo.cc compiles without problems with g++.3.0.1 without -pedantic,
> but fails with -pedantic.
> The same problem occured on a i686-pc-cygwin and a alpha-dec-osf5.0 box.
Your code says:
template <typename T>
void A<T>::foo(const std::list<T>& lt) const
{
std::list<T>::const_iterator ci ;
for(ci=lt.begin(); ci!=lt.end(); ++ci)
std::cout << *ci;
}
In this case, "ci" should be declared:
typename std::list<T>::const_iterator ci ;
Richard