bug in g++.3.0.1 for std::list::const_iterator with -pedantic

Richard Sandiford rsandifo@redhat.com
Mon Sep 24 08:55:00 GMT 2001


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



More information about the Gcc-bugs mailing list