Bug 10898 - [3.3 regression] ICE on illegal template parameter (resume_binding_level, at cp/decl.c:598)
Summary: [3.3 regression] ICE on illegal template parameter (resume_binding_level, at ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P2 critical
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2003-05-21 07:26 UTC by hajira_a1
Modified: 2003-07-25 16:44 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
param.ii (94.16 KB, text/x-c++)
2003-05-21 15:17 UTC, hajira_a1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hajira_a1 2003-05-21 07:26:00 UTC

Release:
gcc 3.2

Environment:
HP-UX itanium2 B.11.22 U ia64 3300317291
Comment 1 Volker Reichelt 2003-05-22 09:01:42 UTC
The code is invalid, the "class/typename" keyword is missing in line 2560ff:

  template< _Alloc>
    class allocator;

  template< _CharT, _Traits = char_traits<_CharT>,
           _Alloc = allocator<_CharT> >
    class basic_string;

So we have on ice-on-invalid-code. A reduced example is:

--------------------------------------------------------------
template <BOGUS> struct A;

namespace std {}
--------------------------------------------------------------

The error message (3.3) is:

PR10898.cc:1: error: parse error before `>' token
PR10898.cc:2: internal compiler error: in resume_binding_level, at cp/decl.c:598
Please submit a full bug report, [etc.]

The code crashes gcc 3.0 - 3.3 (checked on i686-pc-linux-gnu).
Gcc 2.95.3 and mainline work fine.
Comment 2 Volker Reichelt 2003-05-22 11:20:10 UTC
Fixing the missing "typename" keyword, I get another ICE, this time a segfault,
which can be reduced to the following code snippet:

----------------------------------------------------------------
template <BOGUS> struct A
{
    typedef BOGUS X;
    int i;
};
----------------------------------------------------------------

PR10898B.cc:1: error: parse error before `>' token
PR10898B.cc:4: error: template declaration of `int i'
PR10898B.cc:4: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]

This ICE can be observed with gcc 2.95.x - 3.3.
The bug is fixed on mainline.

Btw., it looks as if all keywords "typename" were erased in "param.ii".
That needs to be fixed in order to make the code compile.
Comment 3 Giovanni Bajo 2003-05-22 11:34:59 UTC
*** Bug 10708 has been marked as a duplicate of this bug. ***
Comment 4 Andrew Pinski 2003-06-23 16:18:23 UTC
Moving target back to 3.3.1.
Comment 5 Andrew Pinski 2003-06-29 16:08:17 UTC
Closing as it is fixed in the mainline and there is a sensible error message there.