[clang] [Clang] [C23] Implement N2653: u8 strings are char8_t[] (PR #97208)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 07:43:21 PDT 2024


================
@@ -1165,6 +1165,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
   DefineType("__WCHAR_TYPE__", TI.getWCharType(), Builder);
   DefineType("__WINT_TYPE__", TI.getWIntType(), Builder);
   DefineTypeSizeAndWidth("__SIG_ATOMIC", TI.getSigAtomicType(), TI, Builder);
+  if (LangOpts.Char8 || LangOpts.C23)
+    DefineType("__CHAR8_TYPE__", TI.UnsignedChar, Builder);
----------------
AaronBallman wrote:

Hmmm that is surprising, because it expands to `unsigned char` and not `char8_t` there: https://godbolt.org/z/Y96bPbj8e and this seems to have changed between GCC 8 and GCC 9: https://godbolt.org/z/EaEPKr59E

It may be worth opening a GCC bug to see if this was intentional or not.

https://github.com/llvm/llvm-project/pull/97208


More information about the cfe-commits mailing list