Skip to content

Commit 2b885f0

Browse files
committed
Fix test for bots that don't default to C17
1 parent 40740c4 commit 2b885f0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

clang/test/C/C2y/n3346.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic -ffreestanding %s
2-
// RUN: %clang_cc1 -verify=expected,ped -Wall -pedantic -ffreestanding %s
2+
// RUN: %clang_cc1 -std=c99 -verify=expected,ped -Wall -pedantic -ffreestanding %s
33

44
/* WG14 N3346: Yes
55
* Slay Some Earthly Demons VIII
@@ -33,8 +33,6 @@ void test1(void) {
3333

3434
void test2(void) {
3535
typedef __WCHAR_TYPE__ wchar_t;
36-
typedef __CHAR16_TYPE__ char16_t;
37-
typedef __CHAR32_TYPE__ char32_t;
3836

3937
// The initializer for an array shall be either a string literal, optionally
4038
// enclosed in braces, or a brace-enclosed list of initializers for the
@@ -54,19 +52,23 @@ void test2(void) {
5452
wchar_t str8[] = { L"string literal" };
5553

5654
#if __STDC_VERSION__ >= 201112L
55+
typedef __CHAR16_TYPE__ char16_t;
56+
typedef __CHAR32_TYPE__ char32_t;
57+
5758
char str3[] = u8"string literal";
5859
char str4[] = { u8"string literal" };
5960

6061
char16_t str9[] = u"string literal";
6162
char16_t str10[] = { u"string literal" };
6263
char32_t str11[] = U"string literal";
6364
char32_t str12[] = { U"string literal" };
64-
#endif
6565

66-
wchar_t str13[] = "nope"; // expected-error {{initializing wide char array with non-wide string literal}}
67-
wchar_t str14[] = { "nope" }; // expected-error-re {{incompatible pointer to integer conversion initializing 'wchar_t' (aka '{{.*}}') with an expression of type 'char[5]'}}
6866
char16_t str15[] = "nope"; // expected-error {{initializing wide char array with non-wide string literal}}
6967
char16_t str16[] = { "nope" }; // expected-error-re {{incompatible pointer to integer conversion initializing 'char16_t' (aka '{{.*}}') with an expression of type 'char[5]'}}
7068
char32_t str17[] = "nope"; // expected-error {{initializing wide char array with non-wide string literal}}
7169
char32_t str18[] = { "nope" }; // expected-error-re {{incompatible pointer to integer conversion initializing 'char32_t' (aka '{{.*}}') with an expression of type 'char[5]'}}
70+
#endif
71+
72+
wchar_t str13[] = "nope"; // expected-error {{initializing wide char array with non-wide string literal}}
73+
wchar_t str14[] = { "nope" }; // expected-error-re {{incompatible pointer to integer conversion initializing 'wchar_t' (aka '{{.*}}') with an expression of type 'char[5]'}}
7274
}

0 commit comments

Comments
 (0)