1 // P2362R3 - Remove non-encodable wide character literals and multicharacter
2 // wide character literals.
4 // { dg-require-effective-target 4byte_wchar_t }
7 int b = 'ab'; // { dg-warning "multi-character character constant" }
8 int c = '\u05D9'; // { dg-error "character not encodable in a single execution character code unit" }
10 int d = '\U0001F525'; // { dg-error "character not encodable in a single execution character code unit" "" { target int32 } }
12 int e = 'abcd'; // { dg-warning "multi-character character constant" "" { target int32plus } }
13 // { dg-warning "multi-character literal with \[0-9]+ characters exceeds 'int' size of \[0-9]+ bytes" "" { target { ! int32plus } } .-1 }
15 wchar_t g = L'gh'; // { dg-error "multi-character literal cannot have an encoding prefix" "" { target c++23 } }
16 // { dg-warning "multi-character literal cannot have an encoding prefix" "" { target c++20_down } .-1 }
17 wchar_t h = L'ijkl'; // { dg-error "multi-character literal cannot have an encoding prefix" "" { target c++23 } }
18 // { dg-warning "multi-character literal cannot have an encoding prefix" "" { target c++20_down } .-1 }
19 wchar_t i = L'\U0001F525'; // { dg-error "multi-character literal cannot have an encoding prefix" "" { target { c++23 && { ! 4byte_wchar_t } } } }
20 // { dg-warning "multi-character literal cannot have an encoding prefix" "" { target { c++20_down && { ! 4byte_wchar_t } } } .-1 }
26 #if __cpp_unicode_characters >= 201411
28 u8 k = u8'kl'; // { dg-error "multi-character literal cannot have an encoding prefix" "" { target c++17 } }
29 u8 l = u8'\U0001F525'; // { dg-error "character not encodable in a single code unit" "" { target c++17 } }
31 #if __cpp_unicode_characters >= 200704
33 char16_t n = u'no'; // { dg-error "multi-character literal cannot have an encoding prefix" "" { target c++11 } }
34 char16_t o = u'\u05D9';
35 char16_t p = u'\U0001F525'; // { dg-error "character not encodable in a single code unit" "" { target c++11 } }
37 char32_t r = U'no'; // { dg-error "multi-character literal cannot have an encoding prefix" "" { target c++11 } }
38 char32_t s = U'\u05D9';
39 char32_t t = U'\U0001F525';
41 wchar_t u = L'\u0065\u0301'; // { dg-error "multi-character literal cannot have an encoding prefix" "" { target c++23 } }
42 // { dg-warning "multi-character literal cannot have an encoding prefix" "" { target c++20_down } .-1 }
43 wchar_t v = L'é'; // { dg-error "multi-character literal cannot have an encoding prefix" "" { target c++23 } }
44 // { dg-warning "multi-character literal cannot have an encoding prefix" "" { target c++20_down } .-1 }