public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1306] c++: Test for mixed string literal concatenation Date: Tue, 8 Jun 2021 19:35:14 +0000 (GMT) [thread overview] Message-ID: <20210608193514.4F60A3984C1A@sourceware.org> (raw) https://gcc.gnu.org/g:924e02553af64b10c485711d635c0bc0265a8743 commit r12-1306-g924e02553af64b10c485711d635c0bc0265a8743 Author: Jason Merrill <jason@redhat.com> Date: Tue Jun 8 14:38:42 2021 -0400 c++: Test for mixed string literal concatenation From wg21.link/p2201r1 gcc/cp/ChangeLog: * parser.c (cp_parser_string_literal): Adjust diagnostic. gcc/testsuite/ChangeLog: * g++.dg/cpp23/mixed-concat1.C: New test. Diff: --- gcc/cp/parser.c | 4 ++-- gcc/testsuite/g++.dg/cpp23/mixed-concat1.C | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 24f248af11c..d59a829d0b9 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -4378,8 +4378,8 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok, rich_location rich_loc (line_table, tok->location); rich_loc.add_range (last_tok_loc); error_at (&rich_loc, - "unsupported non-standard concatenation " - "of string literals"); + "concatenation of string literals with " + "conflicting encoding prefixes"); } } diff --git a/gcc/testsuite/g++.dg/cpp23/mixed-concat1.C b/gcc/testsuite/g++.dg/cpp23/mixed-concat1.C new file mode 100644 index 00000000000..d69fafc862d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/mixed-concat1.C @@ -0,0 +1,21 @@ +// Test from P2201R1 +// { dg-do compile { target c++11 } } + +void f() { + + { auto a = L"" u""; } // { dg-error "concatenation" } + { auto a = L"" u8""; } // { dg-error "concatenation" } + { auto a = L"" U""; } // { dg-error "concatenation" } + + { auto a = u8"" L""; } // { dg-error "concatenation" } + { auto a = u8"" u""; } // { dg-error "concatenation" } + { auto a = u8"" U""; } // { dg-error "concatenation" } + + { auto a = u"" L""; } // { dg-error "concatenation" } + { auto a = u"" u8""; } // { dg-error "concatenation" } + { auto a = u"" U""; } // { dg-error "concatenation" } + + { auto a = U"" L""; } // { dg-error "concatenation" } + { auto a = U"" u""; } // { dg-error "concatenation" } + { auto a = U"" u8""; } // { dg-error "concatenation" } +}
reply other threads:[~2021-06-08 19:35 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210608193514.4F60A3984C1A@sourceware.org \ --to=jason@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).