The following invalid code snippet causes an ICE on mainline:

===============================
namespace N
{
    struct A;
}

template<int> struct N::A {};
===============================

  bug.cc:6: error: 'template<int <anonymous> > struct N::A' redeclared as
different kind of symbol
  bug.cc:3: error: previous declaration of 'struct N::A'
  bug.cc:6: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in cp_parser_class_specifier, at cp/parser.c:12298
  Please submit a full bug report, [etc.]

The regression was introduced here:
: Search converges between 2004-02-01-trunk (#445) and 2004-03-01-trunk (#446).

Looks like we don't handle cp_parser_class_head returning error_mark_node
in cp_parser_class_specifier.

Should we always return NULL_TREE if cp_parser_class_head fails?
Or should we check for error_mark_node in cp_parser_class_specifier
as well? (Since both cases will probably handled in the same code path,
the former makes more sense to me.)

-- 
           Summary: [4.0 regression] ICE redeclaring struct as template
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18758

Reply via email to