[PATCH] D127363: [Lex] Fix for char32_t literal truncation on 16 bit architectures

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 14 13:53:26 PDT 2022


tahonermann added a comment.

>> Additionally, the type of a character constant in C is int.
>
> This means that char32_t c4 = U'\U00064321'; is invalid in C

No. A character constant that does not have an encoding prefix has type `int` in C. Character constants that have an encoding prefix have the type indicated by the encoding prefix. `U'\U00064321'` has type `char32_t` in C (a typedef of `uint_least32_t` which is a typedef of some integer type).

When posting an updated patch, please make sure to add the `-U99999` option to `diff` to ensure that surrounding code context is available for code reviewers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127363



More information about the cfe-commits mailing list