This is the mail archive of the
mailing list for the GCC project.
Re: -pedantic and typename
Gerald Pfeifer writes:
> template <class T>
> class NAMESTABLE
> typedef /*typename*/ vector<T>::iterator iterator;
> 1) Is ``typename'' really required here?
Yes, because vector<T>::iterator is dependent on a template argument.
You must tell the compiler it is a typename, otherwise it must *not*
be considered a typename.
> 2) Even if so, and the warning is okay -- why that error?
Not emitting the error would be wrong, and -pedantic and -ansi both
try to have a compiler that is as much ANSI/ISO C++ compliant as
> 3) According to gcc.info -pedantic only changes behavior according to
> ANSI C. Apparently, however, it also does something similar with
> regard to ISO C++.
> Should the docs be updated in this direction?
I think so.
Universidade Estadual de Campinas, SP, Brasil