[clang] [llvm] [Clang][C++23] Core language changes from P1467R9 extended floating-point types and standard names. (PR #78503)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 14:37:55 PST 2025


================
@@ -470,8 +470,16 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
     if (LangOpts.CPlusPlus26)
       // FIXME: Use correct value for C++26.
       Builder.defineMacro("__cplusplus", "202400L");
-    else if (LangOpts.CPlusPlus23)
+    else if (LangOpts.CPlusPlus23) {
       Builder.defineMacro("__cplusplus", "202302L");
+      // [C++23] 15.11p2 [cpp.predefined]
+      if (TI.hasFloat16Type()) {
+        Builder.defineMacro("__STDCPP_FLOAT16_T__", "1");
+      }
+      if (TI.hasFullBFloat16Type()) {
+        Builder.defineMacro("__STDCPP_BFLOAT16_T__", "1");
+      }
----------------
jcranmer-intel wrote:

If I'm understanding the code correctly, these don't get defined in C++26 mode, which seems like a bug to me.

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


More information about the llvm-commits mailing list