1 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
2 /* Expected errors for char16_t/char32_t string literals. */
3 /* { dg-do compile } */
4 /* { dg-require-effective-target wchar } */
5 /* { dg-options "-std=gnu99" } */
9 typedef __CHAR16_TYPE__ char16_t
;
10 typedef __CHAR32_TYPE__ char32_t
;
12 const char s_0
[] = "ab";
13 const char s_1
[] = u
"ab"; /* { dg-error "from wide string" } */
14 const char s_2
[] = U
"ab"; /* { dg-error "from wide string" } */
15 const char s_3
[] = L
"ab"; /* { dg-error "from wide string" } */
17 const char16_t s16_0
[] = "ab"; /* { dg-error "from non-wide" } */
18 const char16_t s16_1
[] = u
"ab";
19 const char16_t s16_2
[] = U
"ab"; /* { dg-error "from incompatible" } */
20 const char16_t s16_3
[] = L
"ab"; /* { dg-error "from incompatible" "" { target { ! wchar_t_char16_t_compatible } } } */
22 const char16_t s16_4
[0] = u
"ab"; /* { dg-warning "chars is too long" } */
23 const char16_t s16_5
[1] = u
"ab"; /* { dg-warning "chars is too long" } */
24 const char16_t s16_6
[2] = u
"ab";
25 const char16_t s16_7
[3] = u
"ab";
26 const char16_t s16_8
[4] = u
"ab";
28 const char32_t s32_0
[] = "ab"; /* { dg-error "from non-wide" } */
29 const char32_t s32_1
[] = u
"ab"; /* { dg-error "from incompatible" } */
30 const char32_t s32_2
[] = U
"ab";
31 const char32_t s32_3
[] = L
"ab"; /* { dg-error "from incompatible" "" { target { ! wchar_t_char32_t_compatible } } } */
33 const char32_t s32_4
[0] = U
"ab"; /* { dg-warning "chars is too long" } */
34 const char32_t s32_5
[1] = U
"ab"; /* { dg-warning "chars is too long" } */
35 const char32_t s32_6
[2] = U
"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
36 const char32_t s32_7
[3] = U
"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
37 const char32_t s32_8
[4] = U
"ab"; /* { dg-warning "chars is too long" "" { target "m32c-*-*" } } */
39 const wchar_t sw_0
[] = "ab"; /* { dg-error "from non-wide" } */
40 const wchar_t sw_1
[] = u
"ab"; /* { dg-error "from incompatible" "" { target { ! wchar_t_char16_t_compatible } } } */
41 const wchar_t sw_2
[] = U
"ab"; /* { dg-error "from incompatible" "" { target { ! wchar_t_char32_t_compatible } } } */
42 const wchar_t sw_3
[] = L
"ab";