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
On Mon, 2001-09-24 at 17:55, Richard Sandiford wrote:
> 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 ;
Would it be possible to make the error message more verbose and
intuitive?
I recently hunted a similar problem in my code and found myself wasting
several hours to find the cause ;)
Ralf