This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

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


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


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