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.
This commit is contained in:
parent
5668b5d09a
commit
924e02553a
2 changed files with 23 additions and 2 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
21
gcc/testsuite/g++.dg/cpp23/mixed-concat1.C
Normal file
21
gcc/testsuite/g++.dg/cpp23/mixed-concat1.C
Normal file
|
@ -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" }
|
||||
}
|
Loading…
Add table
Reference in a new issue