1 // RUN: %clang_cc1 -fchar8_t -std=c++17 -verify %s
2 // RUN: %clang_cc1 -std=c++2a -verify %s
7 char8_t d
[] = "foo"; // expected-error {{initializing 'char8_t' array with plain string literal}} expected-note {{add 'u8' prefix}}
11 #if __cplusplus <= 201703L
12 // expected-error@-2 {{initialization of char array with UTF-8 string literal is not permitted by '-fchar8_t'}}
14 // expected-error@-4 {{ISO C++20 does not permit initialization of char array with UTF-8 string literal}}
23 void operator""_a(char);
24 void operator""_a(const char*, decltype(sizeof(0)));
27 int &x
= u8
'a'_a
; // expected-error {{no matching literal operator}}
28 float &y
= u8
"a"_a
; // expected-error {{no matching literal operator}}
31 int &operator""_a(char8_t
);
32 float &operator""_a(const char8_t
*, decltype(sizeof(0)));
39 template<typename E
, typename T
> void check(T
&&t
) {
43 void check_deduction() {
44 check
<char8_t
>(u8
'a');
45 check
<const char8_t(&)[5]>(u8
"a\u1000");
48 static_assert(sizeof(char8_t
) == 1);
49 static_assert(char8_t(-1) > 0);
50 static_assert(u8
"\u0080"[0] > 0);