[PATCH] D119221: [clang][lexer] Allow u8 character literal prefixes in C2x

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 21 00:54:47 PST 2022


tbaeder marked an inline comment as done.
tbaeder added inline comments.


================
Comment at: clang/test/Lexer/utf8-char-literal.cpp:24
+char g = u8'\x80';          // expected-warning {{implicit conversion from 'int' to 'char' changes value from 128 to -128}}
 #endif
----------------
tahonermann wrote:
> We should also exercise the preprocessor with something like this:
>   #if u8'\xff' != 0xff
>   #error uh oh
>   #endif
> 
> Hmm, this currently fails for C++20 for both Clang and gcc unless `-funsigned-char` is passed. That seems wrong. https://godbolt.org/z/Tb7z85ToG. MSVC gets this wrong too, but I think for a different reason; see the implementation impact section of [[ https://wg21.link/p2029 | P2029 ]] if curious.
This also fails in C2x.


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

https://reviews.llvm.org/D119221



More information about the cfe-commits mailing list