[clang] [Clang] Implement P3074R7: trivial unions (C++26) (PR #185886)

Peng Xie via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 23:07:08 PDT 2026


================
@@ -746,6 +746,10 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
   Builder.defineMacro("__cpp_variadic_friend", "202403L");
   Builder.defineMacro("__cpp_trivial_relocatability", "202502L");
 
+  // C++26 features.
+  if (LangOpts.CPlusPlus26)
+    Builder.defineMacro("__cpp_trivial_union", "202502L");
----------------
love1angel wrote:

Thanks. I read it from https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#__cpp_trivial_union

the value is 202502

but P3726 bump the version https://isocpp.org/files/papers/P3726R2.html#feature-test-macro. so update the value in this pr #185830

Should I update directly to the last value, or keep them separate?

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


More information about the cfe-commits mailing list