unicode-strings.c 1.0 KB

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