public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-96380-4-5t2aiGyX3L@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96380-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:001c63d15e31bc0a1545426d889a0b9f671b4961

commit r12-42-g001c63d15e31bc0a1545426d889a0b9f671b4961
Author: Marek Polacek <polacek@redhat.com>
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 <class>
      enum struct c : union enum struct c { e = b, f = 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-specifier
    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.

  parent reply	other threads:[~2021-04-21 15:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 16:50 [Bug c++/96380] New: [10/11 " haoxintu at gmail dot com
2020-07-30  6:05 ` [Bug c++/96380] " rguenth at gcc dot gnu.org
2020-07-30  7:41 ` marxin at gcc dot gnu.org
2020-07-30  7:41 ` marxin at gcc dot gnu.org
2020-07-30 15:10 ` mpolacek at gcc dot gnu.org
2020-10-12 12:40 ` rguenth at gcc dot gnu.org
2021-03-29 16:54 ` jakub at gcc dot gnu.org
2021-03-29 17:04 ` mpolacek at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-04-20 16:17 ` mpolacek at gcc dot gnu.org
2021-04-20 19:38 ` [Bug c++/96380] [10/11/12 " mpolacek at gcc dot gnu.org
2021-04-21 15:12 ` cvs-commit at gcc dot gnu.org [this message]
2021-04-21 15:14 ` [Bug c++/96380] [10/11 " mpolacek at gcc dot gnu.org
2021-04-27 16:41 ` cvs-commit at gcc dot gnu.org
2021-12-02 13:29 ` [Bug c++/96380] [10 " mpolacek at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-96380-4-5t2aiGyX3L@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).