[clang] [libcxx] [llvm] [Clang] Add warnings when mixing different charN_t types (PR #138708)
Dimitrij Mijoski via cfe-commits
cfe-commits at lists.llvm.org
Wed May 14 17:22:38 PDT 2025
================
@@ -484,7 +484,7 @@ template <class InternT, class ExternT>
void utf8_to_utf16_in_ok(const std::codecvt<InternT, ExternT, mbstate_t>& cvt) {
// UTF-8 string of 1-byte CP, 2-byte CP, 3-byte CP and 4-byte CP
const unsigned char input[] = "b\u0448\uAAAA\U0010AAAA";
- const char16_t expected[] = {'b', 0x0448, 0xAAAA, 0xDBEA, 0xDEAA, 0};
+ const InternT expected[] = {0x62, 0x0448, 0xAAAA, 0xDBEA, 0xDEAA, 0};
static_assert(array_size(input) == 11, "");
static_assert(array_size(expected) == 6, "");
----------------
dimztimz wrote:
Initially these test were written in c++11 and the variable `expected` was Unicode string literal. The variable `exp` is there to get the type i want. I use the same trick for the input data, see variables `input` and `in`. But later I ported this test to be c++98 because appreantly libc++ supports these codecvts in that mode too, and i had to drop the usage of Unicode string literals.
https://github.com/llvm/llvm-project/pull/138708
More information about the cfe-commits
mailing list