[clang] b70d130 - Another speculative fix for WG14 N3346
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 8 10:13:20 PST 2024
Author: Aaron Ballman
Date: 2024-11-08T13:12:27-05:00
New Revision: b70d1302cf2edaf95817a90f161691c684945273
URL: https://github.com/llvm/llvm-project/commit/b70d1302cf2edaf95817a90f161691c684945273
DIFF: https://github.com/llvm/llvm-project/commit/b70d1302cf2edaf95817a90f161691c684945273.diff
LOG: Another speculative fix for WG14 N3346
This time it's for builders that don't default to C11 or later, such as:
https://lab.llvm.org/buildbot/#/builders/144/builds/11201
Added:
Modified:
clang/test/C/C2y/n3346.c
Removed:
################################################################################
diff --git a/clang/test/C/C2y/n3346.c b/clang/test/C/C2y/n3346.c
index d649181f100448..1240224216df9a 100644
--- a/clang/test/C/C2y/n3346.c
+++ b/clang/test/C/C2y/n3346.c
@@ -46,18 +46,22 @@ void test2(void) {
// respectively).
char str1[] = "string literal";
char str2[] = { "string literal" };
- char str3[] = u8"string literal";
- char str4[] = { u8"string literal" };
float str5[] = "this doesn't work"; // expected-error {{array initializer must be an initializer list}}
float str6[] = { "this also doesn't work" }; // expected-error {{initializing 'float' with an expression of incompatible type 'char[23]'}}
wchar_t str7[] = L"string literal";
wchar_t str8[] = { L"string literal" };
+
+#if __STDC_VERSION__ >= 201112L
+ char str3[] = u8"string literal";
+ char str4[] = { u8"string literal" };
+
char16_t str9[] = u"string literal";
char16_t str10[] = { u"string literal" };
char32_t str11[] = U"string literal";
char32_t str12[] = { U"string literal" };
+#endif
wchar_t str13[] = "nope"; // expected-error {{initializing wide char array with non-wide string literal}}
wchar_t str14[] = { "nope" }; // expected-error-re {{incompatible pointer to integer conversion initializing 'wchar_t' (aka '{{.*}}') with an expression of type 'char[5]'}}
More information about the cfe-commits
mailing list