| 1 |
// C++26 P2361R6 - Unevaluated strings |
| 2 |
// { dg-do compile { target c++26 } } |
| 3 |
|
| 4 |
static_assert (true, "foo"); |
| 5 |
static_assert (true, "foo" " " "bar"); |
| 6 |
static_assert (true, "\u01FC\U000001FC\u{1FC}\N{LATIN CAPITAL LETTER AE WITH ACUTE}\\\'\"\?\a\b\f\n\r\t\v"); |
| 7 |
static_assert (true, L"foo"); // { dg-error "a wide string is invalid in this context" } |
| 8 |
static_assert (true, u"foo"); // { dg-error "a wide string is invalid in this context" } |
| 9 |
static_assert (true, U"foo"); // { dg-error "a wide string is invalid in this context" } |
| 10 |
static_assert (true, u8"foo"); // { dg-error "a wide string is invalid in this context" } |
| 11 |
static_assert (true, L"fo" "o"); // { dg-error "a wide string is invalid in this context" } |
| 12 |
static_assert (true, u"fo" "o"); // { dg-error "a wide string is invalid in this context" } |
| 13 |
static_assert (true, U"fo" "o"); // { dg-error "a wide string is invalid in this context" } |
| 14 |
static_assert (true, u8"fo" "o"); // { dg-error "a wide string is invalid in this context" } |
| 15 |
static_assert (true, "fo" L"o"); // { dg-error "a wide string is invalid in this context" } |
| 16 |
static_assert (true, "fo" u"o"); // { dg-error "a wide string is invalid in this context" } |
| 17 |
static_assert (true, "fo" U"o"); // { dg-error "a wide string is invalid in this context" } |
| 18 |
static_assert (true, "fo" u8"o"); // { dg-error "a wide string is invalid in this context" } |
| 19 |
static_assert (true, "\0"); // { dg-error "numeric escape sequence in unevaluated string" } |
| 20 |
static_assert (true, "\17"); // { dg-error "numeric escape sequence in unevaluated string" } |
| 21 |
static_assert (true, "\x20"); // { dg-error "numeric escape sequence in unevaluated string" } |
| 22 |
static_assert (true, "\o{17}"); // { dg-error "numeric escape sequence in unevaluated string" } |
| 23 |
static_assert (true, "\x{20}"); // { dg-error "numeric escape sequence in unevaluated string" } |
| 24 |
static_assert (true, "\h"); // { dg-error "unknown escape sequence" } |
| 25 |
|
| 26 |
extern "C" "+" "+" int f0 (); |
| 27 |
extern "C" int f1 (); |
| 28 |
extern "C" { int f2 (); }; |
| 29 |
extern L"C" int f3 (); // { dg-error "a wide string is invalid in this context" } |
| 30 |
extern L"C" { int f4 (); } // { dg-error "a wide string is invalid in this context" } |
| 31 |
extern u"C" int f5 (); // { dg-error "a wide string is invalid in this context" } |
| 32 |
extern u"C" { int f6 (); } // { dg-error "a wide string is invalid in this context" } |
| 33 |
extern U"C" int f7 (); // { dg-error "a wide string is invalid in this context" } |
| 34 |
extern U"C" { int f8 (); } // { dg-error "a wide string is invalid in this context" } |
| 35 |
extern u8"C" int f9 (); // { dg-error "a wide string is invalid in this context" } |
| 36 |
extern u8"C" { int f10 (); } // { dg-error "a wide string is invalid in this context" } |
| 37 |
extern "\x43" int f11 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 38 |
extern "\x{43}" { int f12 (); } // { dg-error "numeric escape sequence in unevaluated string" } |
| 39 |
extern "\103" int f13 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 40 |
extern "\o{0103}" { int f14 (); } // { dg-error "numeric escape sequence in unevaluated string" } |
| 41 |
|
| 42 |
[[deprecated ("foo")]] int g0 (); |
| 43 |
[[deprecated ("foo" " " "bar")]] int g1 (); |
| 44 |
[[deprecated ("\u01FC\U000001FC\u{1FC}\N{LATIN CAPITAL LETTER AE WITH ACUTE}\\\'\"\?\a\b\f\n\r\t\v")]] int g2 (); |
| 45 |
[[deprecated (L"foo")]] int g3 (); // { dg-error "a wide string is invalid in this context" } |
| 46 |
[[deprecated (u"foo")]] int g4 (); // { dg-error "a wide string is invalid in this context" } |
| 47 |
[[deprecated (U"foo")]] int g5 (); // { dg-error "a wide string is invalid in this context" } |
| 48 |
[[deprecated (u8"foo")]] int g6 (); // { dg-error "a wide string is invalid in this context" } |
| 49 |
[[deprecated (L"fo" "o")]] int g7 (); // { dg-error "a wide string is invalid in this context" } |
| 50 |
[[deprecated (u"fo" "o")]] int g8 (); // { dg-error "a wide string is invalid in this context" } |
| 51 |
[[deprecated (U"fo" "o")]] int g9 (); // { dg-error "a wide string is invalid in this context" } |
| 52 |
[[deprecated (u8"fo" "o")]] int g10 (); // { dg-error "a wide string is invalid in this context" } |
| 53 |
[[deprecated ("fo" L"o")]] int g11 (); // { dg-error "a wide string is invalid in this context" } |
| 54 |
[[deprecated ("fo" u"o")]] int g12 (); // { dg-error "a wide string is invalid in this context" } |
| 55 |
[[deprecated ("fo" U"o")]] int g13 (); // { dg-error "a wide string is invalid in this context" } |
| 56 |
[[deprecated ("fo" u8"o")]] int g14 (); // { dg-error "a wide string is invalid in this context" } |
| 57 |
[[deprecated ("\0")]] int g15 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 58 |
[[deprecated ("\17")]] int g16 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 59 |
[[deprecated ("\x20")]] int g17 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 60 |
[[deprecated ("\o{17}")]] int g18 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 61 |
[[deprecated ("\x{20}")]] int g19 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 62 |
[[deprecated ("\h")]] int g20 (); // { dg-error "unknown escape sequence" } |
| 63 |
|
| 64 |
[[nodiscard ("foo")]] int h0 (); |
| 65 |
[[nodiscard ("foo" " " "bar")]] int h1 (); |
| 66 |
[[nodiscard ("\u01FC\U000001FC\u{1FC}\N{LATIN CAPITAL LETTER AE WITH ACUTE}\\\'\"\?\a\b\f\n\r\t\v")]] int h2 (); |
| 67 |
[[nodiscard (L"foo")]] int h3 (); // { dg-error "a wide string is invalid in this context" } |
| 68 |
[[nodiscard (u"foo")]] int h4 (); // { dg-error "a wide string is invalid in this context" } |
| 69 |
[[nodiscard (U"foo")]] int h5 (); // { dg-error "a wide string is invalid in this context" } |
| 70 |
[[nodiscard (u8"foo")]] int h6 (); // { dg-error "a wide string is invalid in this context" } |
| 71 |
[[nodiscard (L"fo" "o")]] int h7 (); // { dg-error "a wide string is invalid in this context" } |
| 72 |
[[nodiscard (u"fo" "o")]] int h8 (); // { dg-error "a wide string is invalid in this context" } |
| 73 |
[[nodiscard (U"fo" "o")]] int h9 (); // { dg-error "a wide string is invalid in this context" } |
| 74 |
[[nodiscard (u8"fo" "o")]] int h10 (); // { dg-error "a wide string is invalid in this context" } |
| 75 |
[[nodiscard ("fo" L"o")]] int h11 (); // { dg-error "a wide string is invalid in this context" } |
| 76 |
[[nodiscard ("fo" u"o")]] int h12 (); // { dg-error "a wide string is invalid in this context" } |
| 77 |
[[nodiscard ("fo" U"o")]] int h13 (); // { dg-error "a wide string is invalid in this context" } |
| 78 |
[[nodiscard ("fo" u8"o")]] int h14 (); // { dg-error "a wide string is invalid in this context" } |
| 79 |
[[nodiscard ("\0")]] int h15 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 80 |
[[nodiscard ("\17")]] int h16 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 81 |
[[nodiscard ("\x20")]] int h17 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 82 |
[[nodiscard ("\o{17}")]] int h18 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 83 |
[[nodiscard ("\x{20}")]] int h19 (); // { dg-error "numeric escape sequence in unevaluated string" } |
| 84 |
[[nodiscard ("\h")]] int h20 (); // { dg-error "unknown escape sequence" } |
| 85 |
|
| 86 |
float operator "" _my0 (const char *); |
| 87 |
float operator "" "" _my1 (const char *); |
| 88 |
float operator L"" _my2 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 89 |
float operator u"" _my3 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 90 |
float operator U"" _my4 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 91 |
float operator u8"" _my5 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 92 |
float operator L"" "" _my6 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 93 |
float operator u"" "" _my7 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 94 |
float operator U"" "" _my8 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 95 |
float operator u8"" "" _my9 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 96 |
float operator "" L"" _my10 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 97 |
float operator "" u"" _my11 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 98 |
float operator "" U"" _my12 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 99 |
float operator "" u8"" _my13 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 100 |
float operator "\0" _my14 (const char *); // { dg-error "expected empty string after 'operator' keyword" } |
| 101 |
float operator "\x00" _my15 (const char *); // { dg-error "expected empty string after 'operator' keyword" } |
| 102 |
float operator "\h" _my16 (const char *); // { dg-error "expected empty string after 'operator' keyword" } |
| 103 |
// { dg-error "unknown escape sequence" "" { target *-*-* } .-1 } |
| 104 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 105 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 106 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 107 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 108 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 109 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 110 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 111 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 112 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 113 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 114 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 115 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 116 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 117 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 118 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 119 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 120 |
// { dg-warning "space between quotes and suffix is deprecated" "" { target *-*-* } .-18 } |
| 121 |
|
| 122 |
float operator ""_my20 (const char *); |
| 123 |
float operator "" ""_my21 (const char *); |
| 124 |
float operator L""_my22 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 125 |
float operator u""_my23 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 126 |
float operator U""_my24 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 127 |
float operator u8""_my25 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 128 |
float operator L"" ""_my26 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 129 |
float operator u"" ""_my27 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 130 |
float operator U"" ""_my28 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 131 |
float operator u8"" ""_my29 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 132 |
float operator "" L""_my30 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 133 |
float operator "" u""_my31 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 134 |
float operator "" U""_my32 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 135 |
float operator "" u8""_my33 (const char *); // { dg-error "invalid encoding prefix in literal operator" } |
| 136 |
float operator "\0"_my34 (const char *); // { dg-error "expected empty string after 'operator' keyword" } |
| 137 |
float operator "\x00"_my35 (const char *); // { dg-error "expected empty string after 'operator' keyword" } |
| 138 |
float operator "\h"_my36 (const char *); // { dg-error "expected empty string after 'operator' keyword" } |
| 139 |
// { dg-error "unknown escape sequence" "" { target *-*-* } .-1 } |