From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AD73E39F4424; Wed, 21 Apr 2021 15:12:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD73E39F4424 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96380] [10/11/12 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 Date: Wed, 21 Apr 2021 15:12:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: accepts-invalid, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 15:12:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96380 --- Comment #7 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:001c63d15e31bc0a1545426d889a0b9f671b4961 commit r12-42-g001c63d15e31bc0a1545426d889a0b9f671b4961 Author: Marek Polacek Date: Tue Apr 20 12:16:04 2021 -0400 c++: Don't allow defining types in enum-base [PR96380] In r11-2064 I made cp_parser_enum_specifier commit to tentative parse when seeing a '{'. That still looks like the correct thing to do, but it caused an ICE-on-invalid as well as accepts-invalid. When we have something sneaky like this, which is broken in multiple ways: template enum struct c : union enum struct c { e =3D b, f =3D a }; we parse the "enum struct c" part (that's OK) and then we see that we have an enum-base, so we consume ':' and then parse the type-specifi= er that follows the :. "union enum" is clearly invalid, but we're still parsing tentatively and we parse everything up to the ;, and then throw away the underlying type. We parsed everything because we were tricked into parsing an enum-specifier in an enum-base of another enum-specifier! Not good. Since the grammar for enum-base doesn't allow a defining-type-specifier, only a type-specifier, we should set type_definition_forbidden_message which fixes all the problems in this PR. gcc/cp/ChangeLog: PR c++/96380 * parser.c (cp_parser_enum_specifier): Don't allow defining types in enum-base. gcc/testsuite/ChangeLog: PR c++/96380 * g++.dg/cpp0x/enum_base4.C: New test. * g++.dg/cpp0x/enum_base5.C: New test.=