diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-05-01 05:02:45 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-05-01 05:02:45 +0000 |
commit | 9067f8fb742260d7b7eb0dbc4953706eb41e3506 (patch) | |
tree | ed992716633c4f983cb43dc5d277ba5f8293df40 /test/Lexer | |
parent | 3c933618f386968c0a59973faa258015b0f185e3 (diff) |
Implement P0482R2, support for char8_t type.
This is not yet part of any C++ working draft, and so is controlled by the flag
-fchar8_t rather than a -std= flag. (The GCC implementation is controlled by a
flag with the same name.)
This implementation is experimental, and will be removed or revised
substantially to match the proposal as it makes its way through the C++
committee.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Lexer')
-rw-r--r-- | test/Lexer/char8_t.cpp | 17 | ||||
-rw-r--r-- | test/Lexer/cxx-features.cpp | 7 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/Lexer/char8_t.cpp b/test/Lexer/char8_t.cpp new file mode 100644 index 0000000000..20f820e240 --- /dev/null +++ b/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/test/Lexer/cxx-features.cpp b/test/Lexer/cxx-features.cpp index a7d12e2e14..352f08e73b 100644 --- a/test/Lexer/cxx-features.cpp +++ b/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 |