-pedantic and typename
Gerald Pfeifer
pfeifer@dbai.tuwien.ac.at
Fri Mar 6 05:38:00 GMT 1998
I noticed that the current CVS snapshot generates a warning followed by
an error for the following
---------- snipedee-snip ----------
#include <vector.h>
template <class T>
class NAMESTABLE
{
typedef /*typename*/ vector<T>::iterator iterator;
};
---------- snipedee-snip ----------
when -pedantic is used, but compiles fine without pedantic.
x.cc:6: warning: ANSI C++ forbids typedef which does not specify a type
x.cc:6: cannot declare member `vector<T,__default_alloc_template<false,0>
>::iterator' within `NAMESTABLE<T>'
x.cc:6: parse error before `;'
1) Is ``typename'' really required here?
2) Even if so, and the warning is okay -- why that error?
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?
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