Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/ucn2.C

raw
1 // P1139R2
2 // { dg-do compile { target c++11 } }
3 // { dg-additional-options "-fchar8_t" { target c++17_down } }
4
5 const char16_t *a = u"\U0001F914\u2753";
6 const char32_t *b = U"\U0001F914\u2753";
7 const char16_t *c = u"\uD802"; // { dg-error "is not a valid universal character" }
8 const char16_t *d = u"\U0000DFF0"; // { dg-error "is not a valid universal character" }
9 const char16_t *e = u"\U00110000"; // { dg-error "is outside the UCS codespace" "" { target c++20 } }
10 // { dg-error "converting UCN to execution character set" "" { target *-*-* } .-1 }
11 const char32_t *f = U"\uD802"; // { dg-error "is not a valid universal character" }
12 const char32_t *g = U"\U0000DFF0"; // { dg-error "is not a valid universal character" }
13 const char32_t *h = U"\U00110001"; // { dg-error "is outside the UCS codespace" "" { target c++20 } }
14 #if __cpp_unicode_characters >= 201411
15 const char8_t i = u8'\u00C0'; // { dg-error "character not encodable in a single code unit" "" { target c++17 } }
16 #endif
17 const char16_t j = u'\U0001F914'; // { dg-error "character not encodable in a single code unit" }
18 const char32_t k = U'\U0001F914';
19 #if __cpp_unicode_characters >= 201411
20 const char8_t l = u8'ab'; // { dg-error "multi-character literal cannot have an encoding prefix" "" { target c++17 } }
21 #endif
22 const char16_t m = u'ab'; // { dg-error "multi-character literal cannot have an encoding prefix" }
23 const char32_t n = U'ab'; // { dg-error "multi-character literal cannot have an encoding prefix" }
24 #if __cpp_unicode_characters >= 201411
25 const char8_t o = u8'\U00110002'; // { dg-error "is outside the UCS codespace" "" { target c++20 } }
26 // { dg-error "character not encodable in a single code unit" "" { target c++17 } .-1 }
27 #endif
28 const char16_t p = u'\U00110003'; // { dg-error "is outside the UCS codespace" "" { target c++20 } }
29 // { dg-error "converting UCN to execution character set" "" { target *-*-* } .-1 }
30 const char32_t q = U'\U00110004'; // { dg-error "is outside the UCS codespace" "" { target c++20 } }