This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: egcs 1.1b: strange syntax error under -pedantic
- To: Chris Metcalf <metcalf at incert dot com>
- Subject: Re: egcs 1.1b: strange syntax error under -pedantic
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 28 Sep 1998 21:14:43 -300
- Cc: egcs-bugs at cygnus dot com
- References: <Pine.GSO.3.96.980928124734.10927A-100000@incert.incert.com>
Chris Metcalf <metcalf@incert.com> writes:
> template <class FOO> class A { typedef int a_int; };
> template <class FOO> class B { typedef A<FOO*> A_FOO;
> A_FOO::a_int foo; };
> foo.cpp:7: syntax error before `;'
The error message is correct. According to the C++ Standard, you must
prefix template-dependent qualified type names with the keyword
`typename'. Without -pedantic, it is accepted as an extension. Try:
typename A_FOO::a_int foo;
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil