[Q] bug with -pedantic option ???
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Wed Mar 31 23:54:00 GMT 1999
> Is it a compiler bug or am I doing something wrong??
Thanks for your report. You are doing something wrong.
> list<Type>::const_iterator it1;
[...]
> BUG_egcs_1.1.1_compile_option_pedantic_syntax_error.cpp:43: parse error before `;'
There are two bug. One is that foo<T>::bar might be a value or a type
if you don't know what T is; in the standard, we assume that it is a
value, so
list<Type>::const_iterator it1
is ill-formed ('list<Type>::const_iterator *it1' would be a
multiplication). To tell the compiler we think this is a type, write
typename list<Type>::const_iterator it1
Furthermore, in standard C++, we don't look always at base class
templates. So just writing
const_iterator it2
is also incorrect.
Regards,
Martin
More information about the Gcc-bugs
mailing list