diff options
Diffstat (limited to 'clang/test/Lexer')
-rw-r--r-- | clang/test/Lexer/char8_t.cpp | 17 | ||||
-rw-r--r-- | clang/test/Lexer/cxx-features.cpp | 7 |
2 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/Lexer/char8_t.cpp b/clang/test/Lexer/char8_t.cpp new file mode 100644 index 00000000000..20f820e2401 --- /dev/null +++ b/clang/test/Lexer/char8_t.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -std=c++2a -verify %s +// RUN: %clang_cc1 -std=c++2a -verify %s -fchar8_t + +#if defined(__cpp_char8_t) && __is_identifier(char8_t) +#error char8_t is an identifier under -fchar8_t +#endif + +#if !defined(__cpp_char8_t) && !__is_identifier(char8_t) +#error char8_t is a keyword under -fno-char8_t +#endif + +char8_t c8t; +#ifndef __cpp_char8_t +// expected-error@-2 {{unknown type}} +#else +// expected-no-diagnostics +#endif diff --git a/clang/test/Lexer/cxx-features.cpp b/clang/test/Lexer/cxx-features.cpp index a7d12e2e14f..352f08e73b3 100644 --- a/clang/test/Lexer/cxx-features.cpp +++ b/clang/test/Lexer/cxx-features.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -fsized-deallocation -fconcepts-ts -DCONCEPTS_TS=1 -verify %s // RUN: %clang_cc1 -fno-rtti -fno-threadsafe-statics -verify %s -DNO_EXCEPTIONS -DNO_RTTI -DNO_THREADSAFE_STATICS -fsized-deallocation // RUN: %clang_cc1 -fcoroutines-ts -DNO_EXCEPTIONS -DCOROUTINES -verify -fsized-deallocation %s +// RUN: %clang_cc1 -fchar8_t -DNO_EXCEPTIONS -DCHAR8_T -verify -fsized-deallocation %s // expected-no-diagnostics @@ -242,3 +243,9 @@ #if defined(COROUTINES) ? check(coroutines, 201703L, 201703L, 201703L, 201703L) : check(coroutines, 0, 0, 0, 0) #error "wrong value for __cpp_coroutines" #endif + +// --- not-yet-standard features -- + +#if defined(CHAR8_T) ? check(char8_t, 201803, 201803, 201803, 201803) : check(char8_t, 0, 0, 0, 0) +#error "wrong value for __cpp_char8_t" +#endif |