xref: /aosp_15_r20/external/clang/test/Lexer/unicode-strings.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -x c -std=c11 -Werror %s
2*67e74705SXin Li // RUN: %clang_cc1 -x c++ -std=c++11 -Werror %s
3*67e74705SXin Li // RUN: %clang_cc1 -x c -std=c11 -Wc99-compat -verify %s
4*67e74705SXin Li // RUN: %clang_cc1 -x c++ -std=c++11 -Wc++98-compat -verify %s
5*67e74705SXin Li 
6*67e74705SXin Li #ifndef __cplusplus
7*67e74705SXin Li typedef __CHAR16_TYPE__ char16_t;
8*67e74705SXin Li typedef __CHAR32_TYPE__ char32_t;
9*67e74705SXin Li #else
10*67e74705SXin Li // expected-warning@17 {{'char16_t' type specifier is incompatible with C++98}}
11*67e74705SXin Li // expected-warning@18 {{'char32_t' type specifier is incompatible with C++98}}
12*67e74705SXin Li // expected-warning@20 {{'char16_t' type specifier is incompatible with C++98}}
13*67e74705SXin Li // expected-warning@21 {{'char32_t' type specifier is incompatible with C++98}}
14*67e74705SXin Li #endif
15*67e74705SXin Li 
16*67e74705SXin Li const char *a = u8"abcd"; // expected-warning {{unicode literals are incompatible with}}
17*67e74705SXin Li const char16_t *b = u"abcd"; // expected-warning {{unicode literals are incompatible with}}
18*67e74705SXin Li const char32_t *c = U"abcd"; // expected-warning {{unicode literals are incompatible with}}
19*67e74705SXin Li 
20*67e74705SXin Li char16_t d = u'a'; // expected-warning {{unicode literals are incompatible with}}
21*67e74705SXin Li char32_t e = U'a'; // expected-warning {{unicode literals are incompatible with}}
22