2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / utf16-1.c
blobf2343d2a9458cc7a5e49be707f7194e4d090e631
1 /* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
2 /* Test the support for char16_t character constants. */
3 /* { dg-do run } */
4 /* { dg-options "-std=gnu99 -Wall -Werror" } */
6 typedef __CHAR16_TYPE__ char16_t;
8 extern void abort (void);
10 char16_t c0 = u'a';
11 char16_t c1 = u'\0';
12 char16_t c2 = u'\u0024';
13 char16_t c3 = u'\u2029';
14 char16_t c4 = u'\u8010';
16 char16_t c5 = 'a';
17 char16_t c6 = U'a';
18 char16_t c7 = U'\u2029';
19 char16_t c8 = U'\u8010';
20 char16_t c9 = L'a';
21 char16_t ca = L'\u2029';
22 char16_t cb = L'\u8010';
24 #define A 0x0061
25 #define D 0x0024
26 #define X 0x2029
27 #define Y 0x8010
29 int main ()
31 if (sizeof (u'a') != sizeof (char16_t))
32 abort ();
33 if (sizeof (u'\0') != sizeof (char16_t))
34 abort ();
35 if (sizeof (u'\u0024') != sizeof (char16_t))
36 abort ();
37 if (sizeof (u'\u2029') != sizeof (char16_t))
38 abort ();
39 if (sizeof (u'\u8010') != sizeof (char16_t))
40 abort ();
42 if (c0 != A)
43 abort ();
44 if (c1 != 0x0000)
45 abort ();
46 if (c2 != D)
47 abort ();
48 if (c3 != X)
49 abort ();
50 if (c4 != Y)
51 abort ();
53 if (c5 != A)
54 abort ();
55 if (c6 != A)
56 abort ();
57 if (c7 != X)
58 abort ();
59 if (c8 != Y)
60 abort ();
61 if (c9 != A)
62 abort ();
63 if (ca != X)
64 abort ();
65 if (cb != Y)
66 abort ();