Explict typename

Gabriel Dos Reis Gabriel.Dos-Reis@dptmaths.ens-cachan.fr
Fri Dec 11 05:11:00 GMT 1998


>>>>> Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> wrote:

> On Thu, 10 Dec 1998, Karl JH Millar wrote:
>> template<class T>
>> void foo(T a) {
>> Map<int, T>::iterator i;
>> }
>> 
>> gcc -c -v template.cc -pedantic
>> 
>> I don't get the error compiling without -pedantic.

> Your code is in error but this bug is only detected with -pedantic.
> Correctly you should have written: typename Map<int, T>::iterator i.


> To our C++ experts: This is reported over and over again, so I strongly
> suggest that

>  o the implicit typename extension issues a warning whenever it comes
>    into play.

I recall having made suggestions along these lines a long time ago but...

>  o a better error message is issued instead of "parse error" when 
>    -pedantic is used.


I agree.

-- Gaby




More information about the Gcc-bugs mailing list