-pedantic, and templates, and iterators --> Oh my!

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Fri Jul 7 10:36:00 GMT 2000


> 	This one had me scratching my head for a long time.  I was
> wondering why all my code compiled and worked just fine, but some of
> my co-workers just couldn't get it to compile.  (Isn't it always that
> way?)  Basically, the problem is that the combination of -pedantic,
> templates, and the STL, results in parse errors.

Thanks for your bug report. It's not a bug in the compiler, but in
your code. You need to write

  DataType addThem() const {
    typename list<DataType>::const_iterator
      itr(_them.begin()),
      end(_them.end());
    ...

Regards,
Martin


More information about the Gcc-bugs mailing list