bug in g++.3.0.1 for std::list::const_iterator with -pedantic
Ralf Corsepius
corsepiu@faw.uni-ulm.de
Tue Sep 25 00:26:00 GMT 2001
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
More information about the Gcc-bugs
mailing list