[clang] [Clang] Backport P2741R3 (static_assert with user-generated message) to C++11 (PR #102044)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 04:05:23 PDT 2024


================
@@ -671,10 +671,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
                         LangOpts.CPlusPlus23   ? "202211L"
                         : LangOpts.CPlusPlus17 ? "201603L"
                                                : "200907");
-    Builder.defineMacro("__cpp_static_assert", LangOpts.CPlusPlus26 ? "202306L"
-                                               : LangOpts.CPlusPlus17
-                                                   ? "201411L"
-                                                   : "200410");
+    // C++17 / C++26 static_assert backported
+    Builder.defineMacro("__cpp_static_assert", "202306L");
----------------
philnik777 wrote:

AFAICT this is non-conforming. C++20 requires `__cpp_static_assert` to be `201411L`. Personally I think that's a defect in the standard, but that's not my decision to make. Also note that other feature test macros reflect the standards wording as well and not whether the feature has been backported.

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


More information about the cfe-commits mailing list