[libcxx-commits] [PATCH] D144346: [libc++][format] Improves Unicode decoders.

Tom Honermann via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 7 18:11:59 PST 2023


tahonermann accepted this revision.
tahonermann added a comment.

I reviewed more thoroughly and this looks great to me! I added a comment about a possible preexisting issue with `wchar_t` that it might make sense to address with this change.



================
Comment at: libcxx/include/__format/unicode.h:266
 
+    char32_t __value = *__first_++;
     if constexpr (sizeof(wchar_t) == 2) {
----------------
It is implementation-defined whether `wchar_t` is a signed type so I think a cast to an unsigned type is needed here and in other cases below where `first` is dereferenced.

This would be a good use case for a `std::as_unsigned()` or `std::to_unsigned()` function.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144346/new/

https://reviews.llvm.org/D144346



More information about the libcxx-commits mailing list