Explict typename
Gerald Pfeifer
pfeifer@dbai.tuwien.ac.at
Thu Dec 10 15:55:00 GMT 1998
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.
o a better error message is issued instead of "parse error" when
-pedantic is used.
Gerald
--
Gerald Pfeifer (Jerry) Vienna University of Technology
pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/
More information about the Gcc-bugs
mailing list