OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / ext / 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=c++0x -Wall -Werror" } */
5
6 extern "C" void abort (void);
7
8 const static char32_t   c0 = U'a';
9 const static char32_t   c1 = U'\0';
10 const static char32_t   c2 = U'\u0024';
11 const static char32_t   c3 = U'\u2029';
12 const static char32_t   c4 = U'\U00064321';
13
14 #define A       0x00000061
15 #define D       0x00000024
16 #define X       0x00002029
17 #define Y       0x00064321
18
19 int main ()
20 {
21     if (sizeof (U'a') != sizeof (char32_t))
22         abort ();
23     if (sizeof (U'\0') != sizeof (char32_t))
24         abort ();
25     if (sizeof (U'\u0024') != sizeof (char32_t))
26         abort ();
27     if (sizeof (U'\u2029') != sizeof (char32_t))
28         abort ();
29     if (sizeof (U'\U00064321') != sizeof (char32_t))
30         abort ();
31
32     if (c0 != A)
33         abort ();
34     if (c1 != 0x0000)
35         abort ();
36     if (c2 != D)
37         abort ();
38     if (c3 != X)
39         abort ();
40     if (c4 != Y)
41         abort ();
42 }