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: egcs 1.1b: strange syntax error under -pedantic


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



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