Bug 11862 - [3.4 Regression] ICE on illegal code, in cp_parser_template_id, at cp/parser.c:7515
Summary: [3.4 Regression] ICE on illegal code, in cp_parser_template_id, at cp/parser....
Status: RESOLVED DUPLICATE of bug 10583
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2003-08-09 03:59 UTC by Eelis
Modified: 2004-01-17 04:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-09-07 05:09:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eelis 2003-08-09 03:59:08 UTC
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'?)
Comment 1 Andrew Pinski 2003-08-09 04:08:59 UTC
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.
Comment 2 Wolfgang Bangerth 2003-08-11 14:54:24 UTC
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. 
Comment 3 Kriang Lerdsuwanakij 2003-10-19 13:47:14 UTC
Duplicate of PR10583.  Patch in progress.

*** This bug has been marked as a duplicate of 10583 ***