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++/105300] [10/11/12/13 Regression] segfault from static_assert with user-defined string suffix argument
Date: Thu, 26 Jan 2023 15:08:46 +0000	[thread overview]
Message-ID: <bug-105300-4-mjp6a4gLRT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105300-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:9f353b0c1dc9385ba8b8a64b65d66d5452383c11

commit r13-5390-g9f353b0c1dc9385ba8b8a64b65d66d5452383c11
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Nov 11 17:59:30 2022 -0500

    c++: Reject UDLs in certain contexts [PR105300]

    In this PR, we are crashing because we've encountered a UDL where a
    string-literal is expected.  This patch makes the parser reject string
    and character UDLs in all places where the grammar requires a
    string-literal and not a user-defined-string-literal.

    I've introduced two new wrappers; the existing cp_parser_string_literal
    was renamed to cp_parser_string_literal_common and should not be called
    directly.  finish_userdef_string_literal is renamed from
    cp_parser_userdef_string_literal.

            PR c++/105300

    gcc/c-family/ChangeLog:

            * c-pragma.cc (handle_pragma_message): Warn for CPP_STRING_USERDEF.

    gcc/cp/ChangeLog:

            * parser.cc: Remove unnecessary forward declarations.
            (cp_parser_string_literal): New wrapper.
            (cp_parser_string_literal_common): Renamed from
            cp_parser_string_literal.  Add a bool parameter.  Give an error
when
            UDLs are not permitted.
            (cp_parser_userdef_string_literal): New wrapper.
            (finish_userdef_string_literal): Renamed from
            cp_parser_userdef_string_literal.
            (cp_parser_primary_expression): Call
cp_parser_userdef_string_literal
            instead of cp_parser_string_literal.
            (cp_parser_linkage_specification): Move a variable declaration
closer
            to its first use.
            (cp_parser_static_assert): Likewise.
            (cp_parser_operator): Call cp_parser_userdef_string_literal instead
of
            cp_parser_string_literal.
            (cp_parser_asm_definition): Move a variable declaration closer to
its
            first use.
            (cp_parser_asm_specification_opt): Move variable declarations
closer to
            their first use.
            (cp_parser_asm_operand_list): Likewise.
            (cp_parser_asm_clobber_list): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/udlit-error1.C: New test.

  parent reply	other threads:[~2023-01-26 15:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18  3:51 [Bug c++/105300] New: " Jack at Applin dot US
2022-04-19 14:11 ` [Bug c++/105300] " marxin at gcc dot gnu.org
2022-04-19 17:17 ` marxin at gcc dot gnu.org
2022-11-03  0:21 ` [Bug c++/105300] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-11-03  0:32 ` pinskia at gcc dot gnu.org
2022-11-11 20:39 ` mpolacek at gcc dot gnu.org
2022-12-20 13:39 ` rguenth at gcc dot gnu.org
2023-01-26 15:08 ` cvs-commit at gcc dot gnu.org [this message]
2023-01-26 15:21 ` [Bug c++/105300] [10/11/12 " mpolacek at gcc dot gnu.org
2023-04-10  7:24 ` jakub 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-105300-4-mjp6a4gLRT@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).