OSDN Git Service

libcpp/ChangeLog:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / utf-cvt.c
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-options "-std=gnu99 -Wall -Wconversion -Wsign-conversion" } */
5
6 typedef unsigned short  char16_t;
7 typedef unsigned int    char32_t;
8
9 extern void f_c (char);
10 extern void fsc (signed char);
11 extern void fuc (unsigned char);
12 extern void f_s (short);
13 extern void fss (signed short);
14 extern void fus (unsigned short);
15 extern void f_i (int);
16 extern void fsi (signed int);
17 extern void fui (unsigned int);
18 extern void f_l (long);
19 extern void fsl (signed long);
20 extern void ful (unsigned long);
21
22 void m (char16_t c0, char32_t c1)
23 {
24     f_c (c0);                           /* { dg-warning "alter its value" } */
25     fsc (c0);                           /* { dg-warning "alter its value" } */
26     fuc (c0);                           /* { dg-warning "alter its value" } */
27     f_s (c0);                           /* { dg-warning "change the sign" } */
28     fss (c0);                           /* { dg-warning "change the sign" } */
29     fus (c0);
30     f_i (c0);
31     fsi (c0);
32     fui (c0);
33     f_l (c0);
34     fsl (c0);
35     ful (c0);
36
37     f_c (c1);                           /* { dg-warning "alter its value" } */
38     fsc (c1);                           /* { dg-warning "alter its value" } */
39     fuc (c1);                           /* { dg-warning "alter its value" } */
40     f_s (c1);                           /* { dg-warning "alter its value" } */
41     fss (c1);                           /* { dg-warning "alter its value" } */
42     fus (c1);                           /* { dg-warning "alter its value" } */
43     f_i (c1);                           /* { dg-warning "change the sign" } */
44     fsi (c1);                           /* { dg-warning "change the sign" } */
45     fui (c1);
46     f_l (c1);                           /* { dg-warning "change the sign" } */
47     fsl (c1);                           /* { dg-warning "change the sign" } */
48     ful (c1);
49 }