This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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
possible.

> 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.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]