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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 2 11:51:13 PDT 2024


================
@@ -1342,8 +1342,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
                       getLockFreeValue(TI.get##Type##Width(), TI));
     DEFINE_LOCK_FREE_MACRO(BOOL, Bool);
     DEFINE_LOCK_FREE_MACRO(CHAR, Char);
-    if (LangOpts.Char8)
-      DEFINE_LOCK_FREE_MACRO(CHAR8_T, Char); // Treat char8_t like char.
+    // char8_t has the same representation / width as unsigned
+    // char in C++ and is a typedef for unsigned char in C23
+    if (LangOpts.Char8 || LangOpts.C23)
----------------
AaronBallman wrote:

Ah! Good call, thank you!

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


More information about the cfe-commits mailing list