Skip to content

Commit b70d130

Browse files
committed
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
1 parent 4661467 commit b70d130

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

clang/test/C/C2y/n3346.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,22 @@ void test2(void) {
4646
// respectively).
4747
char str1[] = "string literal";
4848
char str2[] = { "string literal" };
49-
char str3[] = u8"string literal";
50-
char str4[] = { u8"string literal" };
5149

5250
float str5[] = "this doesn't work"; // expected-error {{array initializer must be an initializer list}}
5351
float str6[] = { "this also doesn't work" }; // expected-error {{initializing 'float' with an expression of incompatible type 'char[23]'}}
5452

5553
wchar_t str7[] = L"string literal";
5654
wchar_t str8[] = { L"string literal" };
55+
56+
#if __STDC_VERSION__ >= 201112L
57+
char str3[] = u8"string literal";
58+
char str4[] = { u8"string literal" };
59+
5760
char16_t str9[] = u"string literal";
5861
char16_t str10[] = { u"string literal" };
5962
char32_t str11[] = U"string literal";
6063
char32_t str12[] = { U"string literal" };
64+
#endif
6165

6266
wchar_t str13[] = "nope"; // expected-error {{initializing wide char array with non-wide string literal}}
6367
wchar_t str14[] = { "nope" }; // expected-error-re {{incompatible pointer to integer conversion initializing 'wchar_t' (aka '{{.*}}') with an expression of type 'char[5]'}}

0 commit comments

Comments
 (0)