1 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
2 /* Test the char16_t and char32_t promotion rules. */
3 /* { dg-do compile } */
4 /* { dg-require-effective-target int32plus } */
5 /* { dg-options "-std=gnu99 -Wall -Wconversion -Wsign-conversion" } */
7 typedef __CHAR16_TYPE__ char16_t
;
8 typedef __CHAR32_TYPE__ char32_t
;
10 extern void f_c (char);
11 extern void fsc (signed char);
12 extern void fuc (unsigned char);
13 extern void f_s (short);
14 extern void fss (signed short);
15 extern void fus (unsigned short);
16 extern void f_i (int);
17 extern void fsi (signed int);
18 extern void fui (unsigned int);
19 extern void f_l (long);
20 extern void fsl (signed long);
21 extern void ful (unsigned long);
22 extern void f_ll (long long);
23 extern void fsll (signed long long);
24 extern void full (unsigned long long);
26 void m (char16_t c0
, char32_t c1
)
28 f_c (c0
); /* { dg-warning "conversion from .char16_t\[^\n\r\]*. to .char. may change value" } */
29 fsc (c0
); /* { dg-warning "may change value" } */
30 fuc (c0
); /* { dg-warning "may change value" } */
31 f_s (c0
); /* { dg-warning "change the sign" } */
32 fss (c0
); /* { dg-warning "change the sign" } */
44 f_c (c1
); /* { dg-warning "may change value" } */
45 fsc (c1
); /* { dg-warning "may change value" } */
46 fuc (c1
); /* { dg-warning "may change value" } */
47 f_s (c1
); /* { dg-warning "may change value" } */
48 fss (c1
); /* { dg-warning "may change value" } */
49 fus (c1
); /* { dg-warning "may change value" } */
50 f_i (c1
); /* { dg-warning "change the sign" "" { target { ! int16 } } } */
51 fsi (c1
); /* { dg-warning "change the sign" "" { target { ! int16 } } } */
53 f_l (c1
); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
54 fsl (c1
); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */