The following single (illegal) line: template <typename> void x (y); x< causes an ICE in GCC version 3.4 20030723: t.cpp:1: error: variable or field `x' declared void t.cpp:1: error: template declaration of `int x' t.cpp:1: error: `y' was not declared in this scope t.cpp:2: internal compiler error: in cp_parser_template_id, at cp/parser.c:7515 GCC version 3.2.3 reports the following errors: t.cpp:1: variable or field `x' declared void t.cpp:1: template declaration of `int x' t.cpp:2: parse error at end of input and doesn't end with an ICE (btw: those first two aren't very good errors). (Is this phenomenon of bugs being introduced in newer versions known as 'regression'?)
I can confirm this on the mainline (20030808). This gets a diagnostic so that the error message will be improved. Yes the phenomenon of bugs being introduced in newer versions known as a regression. This was introduced when the new parser was merged into the mainline.
While the error message can certainly be improved, the origin is the following (I guess): gcc looks at y and realizes that this is not a type. It then thinks that it might be a variable, in which case the sequence type name (name) (read: void x (y) ) would be the declaration of a variable with a given initializer (think: constructor call). But variables of type void are not allowed, which is what the message says). W.
Duplicate of PR10583. Patch in progress. *** This bug has been marked as a duplicate of 10583 ***