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

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 18 08:44:44 PST 2022


tahonermann added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:3565
   else
     Ty = Context.CharTy;  // 'x' -> char in C++
 
----------------
Perhaps worth updating this comment? e.g., 
  // 'x' -> char in C++; u8'x' -> char in C11-C17 and in C++ without char8_t.


================
Comment at: clang/test/Lexer/utf8-char-literal.cpp:19
+char b = u8'\x80';   // ok
+char c = u8'\u0080'; // expected-error {{universal character name refers to a control character}}
+char d = u8'\u1234'; // expected-error {{character too large for enclosing character literal type}}
----------------
This is an interesting difference between C and C++ that I was not aware of. Looks right though!


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

https://reviews.llvm.org/D119221



More information about the cfe-commits mailing list