| 1 |
// { dg-do run { target c++11 } } |
| 2 |
// { dg-require-iconv "ISO-8859-2" } |
| 3 |
// { dg-options "-fexec-charset=ISO-8859-2" } |
| 4 |
|
| 5 |
#if __cpp_char8_t |
| 6 |
typedef char8_t u8_char_t; |
| 7 |
#else |
| 8 |
typedef char u8_char_t; |
| 9 |
#endif |
| 10 |
|
| 11 |
const char *str1 = "h\u00e1\U0000010Dky "; |
| 12 |
const char *str2 = "\u010d\u00E1rky\n"; |
| 13 |
const u8_char_t *str3 = u8"h\u00e1\U0000010Dky "; |
| 14 |
const u8_char_t *str4 = u8"\u010d\u00E1rky\n"; |
| 15 |
const char *str5 = "h\u00e1\U0000010Dky " "\u010d\u00E1rky\n"; |
| 16 |
const u8_char_t *str6 = u8"h\u00e1\U0000010Dky " "\u010d\u00E1rky\n"; |
| 17 |
const u8_char_t *str7 = "h\u00e1\U0000010Dky " u8"\u010d\u00E1rky\n"; |
| 18 |
const u8_char_t *str8 = u8"h\u00e1\U0000010Dky " u8"\u010d\u00E1rky\n"; |
| 19 |
|
| 20 |
const char latin2_1[] = "\x68\xe1\xe8\x6b\x79\x20"; |
| 21 |
const char latin2_2[] = "\xe8\xe1\x72\x6b\x79\n"; |
| 22 |
const char utf8_1[] = "\x68\xc3\xa1\xc4\x8d\x6b\x79\x20"; |
| 23 |
const char utf8_2[] = "\xc4\x8d\xc3\xa1\x72\x6b\x79\n"; |
| 24 |
|
| 25 |
int |
| 26 |
main (void) |
| 27 |
{ |
| 28 |
if (__builtin_strcmp (str1, latin2_1) != 0 |
| 29 |
|| __builtin_strcmp (str2, latin2_2) != 0 |
| 30 |
|| __builtin_memcmp (str3, utf8_1, sizeof (utf8_1) - 1) != 0 |
| 31 |
|| __builtin_memcmp (str4, utf8_2, sizeof (utf8_2) - 1) != 0 |
| 32 |
|| __builtin_strncmp (str5, latin2_1, sizeof (latin2_1) - 1) != 0 |
| 33 |
|| __builtin_strcmp (str5 + sizeof (latin2_1) - 1, latin2_2) != 0 |
| 34 |
|| __builtin_memcmp (str6, utf8_1, sizeof (utf8_1) - 1) != 0 |
| 35 |
|| __builtin_memcmp (str6 + sizeof (utf8_1) - 1, utf8_2, sizeof (utf8_2) - 1) != 0 |
| 36 |
|| __builtin_memcmp (str7, utf8_1, sizeof (utf8_1) - 1) != 0 |
| 37 |
|| __builtin_memcmp (str7 + sizeof (utf8_1) - 1, utf8_2, sizeof (utf8_2) - 1) != 0 |
| 38 |
|| __builtin_memcmp (str8, utf8_1, sizeof (utf8_1) - 1) != 0 |
| 39 |
|| __builtin_memcmp (str8 + sizeof (utf8_1) - 1, utf8_2, sizeof (utf8_2) - 1) != 0) |
| 40 |
__builtin_abort (); |
| 41 |
if (sizeof ("a" u8"b"[0]) != 1 |
| 42 |
|| sizeof (u8"a" "b"[0]) != 1 |
| 43 |
|| sizeof (u8"a" u8"b"[0]) != 1 |
| 44 |
|| sizeof ("a" "\u010d") != 3 |
| 45 |
|| sizeof ("a" u8"\u010d") != 4 |
| 46 |
|| sizeof (u8"a" "\u010d") != 4 |
| 47 |
|| sizeof (u8"a" "\u010d") != 4) |
| 48 |
__builtin_abort (); |
| 49 |
return 0; |
| 50 |
} |