[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
Tue Apr 12 23:17:30 PDT 2022


tbaeder marked 2 inline comments 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
----------------
aaron.ballman wrote:
> tbaeder wrote:
> > 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.
> I don't think we need to fix the preprocessor behavior as part of this patch, but it would be good to file an issue for this so we know to track it down at some point.
I've opened https://github.com/llvm/llvm-project/issues/54886


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

https://reviews.llvm.org/D119221



More information about the cfe-commits mailing list