OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / utf32-1.c
1 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
2 /* Test the support for char32_t character constants. */
3 /* { dg-do run } */
4 /* { dg-options "-std=gnu99 -Wall -Werror" } */
5
6 typedef __CHAR32_TYPE__ char32_t;
7
8 extern void abort (void);
9
10 char32_t        c0 = U'a';
11 char32_t        c1 = U'\0';
12 char32_t        c2 = U'\u0024';
13 char32_t        c3 = U'\u2029';
14 char32_t        c4 = U'\U00064321';
15
16 #define A       0x00000061
17 #define D       0x00000024
18 #define X       0x00002029
19 #define Y       0x00064321
20
21 int main ()
22 {
23     if (sizeof (U'a') != sizeof (char32_t))
24         abort ();
25     if (sizeof (U'\0') != sizeof (char32_t))
26         abort ();
27     if (sizeof (U'\u0024') != sizeof (char32_t))
28         abort ();
29     if (sizeof (U'\u2029') != sizeof (char32_t))
30         abort ();
31     if (sizeof (U'\U00064321') != sizeof (char32_t))
32         abort ();
33
34     if (c0 != A)
35         abort ();
36     if (c1 != 0x0000)
37         abort ();
38     if (c2 != D)
39         abort ();
40     if (c3 != X)
41         abort ();
42     if (c4 != Y)
43         abort ();
44 }