This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/20499] New: [4.0/4.1 regression] ICE on duplicate class definition


The following invalid code snippet causes an ICE on the 4.0 branch and
mainline:

==================
struct A
{
    struct B {};
};

struct A::B {};
==================

The error message is:

  bug.cc:6: error: redefinition of 'struct A::B'
  bug.cc:3: error: previous definition of 'struct A::B'
  bug.cc:6: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in cp_parser_class_specifier, at cp/parser.c:12407
  Please submit a full bug report, [etc.]

(Btw, this is the same problem as g++.dg/parse/error16.C.
Why the testsuite doesn't trigger is discussed in
http://gcc.gnu.org/ml/gcc/2005-02/msg00953.html)

The regression was probably caused by Mark's patch for PR c++/20152:

2005-02-22  Mark Mitchell  <mark@codesourcery.com>

	PR c++/20152
	* parser.c (cp_parser_class_head): Check for redefintions here.
	* semantics.c (begin_class_definition): Not here.

A patch will follow soon.

-- 
           Summary: [4.0/4.1 regression] ICE on duplicate class definition
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: reichelt 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=20499


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]