This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: -pedantic, and templates, and iterators --> Oh my!
- To: Mark Fox <mfox at cpsc dot ucalgary dot ca>
- Subject: Re: -pedantic, and templates, and iterators --> Oh my!
- From: llewelly at dbritsch dot dsl dot xmission dot com
- Date: Fri, 7 Jul 2000 10:39:11 -0600 (MDT)
- Cc: gcc-bugs at gcc dot gnu dot org
On Fri, 7 Jul 2000, Mark Fox wrote:
[snip]
> Here's the "minimal" test program:
>
> ---
> #include <iostream>
> #include <list>
>
> template <class DataType>
> class SimpleClass {
> public:
> SimpleClass(list<DataType> const & them)
> : _them(them.begin(), them.end())
> {}
>
> DataType addThem() const {
> list<DataType>::const_iterator
^^^^^You need typename here.
list<DatayType>::const_iterator is dependent on a template
parameter, so the ISO C++ standard requires that typename be used to
tell the compiler it is a type.
Note that without -pedantic, g++ can in some cases (not all) add the
deduce that dependent names are typenames, but that is an extension.
Your code compiles fine with g++ -Wall -pedantic (version 2.95.2) once
typename is added, so this is not a bug in gcc.
thank you for your bug report.