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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 11 06:22:18 PST 2022


aaron.ballman added a reviewer: tahonermann.
aaron.ballman added a comment.

Can you also add a release note for the new feature, and update the `clang/www/c_status.html` page as well?



================
Comment at: clang/test/Lexer/utf8-char-literal.cpp:23
+char f = u8'ab';            // expected-error {{Unicode character literals may not contain multiple characters}}
+char g = u8'\x80';          // expected-warning {{implicit conversion from 'int' to 'char' changes value from 128 to -128}}
 #endif
----------------
One more test I'd like to see added, just to make sure we're covering 6.4.4.4p9 properly:
```
_Static_assert(
  _Generic(u8'a',
           default: 0,
           unsigned char : 1),
  "Surprise!");  
```
We expect the type of a u8 character literal to be `unsigned char` at the moment, which is different from a u8 string literal, which uses `char`.

However, WG14 is also going to be considering http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2653.htm for C2x at our meeting next week.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119221



More information about the cfe-commits mailing list