[clang] [Clang] Partial implementation of support for P3074 (trivial unions) (PR #146815)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 11 08:06:31 PDT 2025


================
@@ -1217,6 +1217,9 @@ void CXXRecordDecl::addedMember(Decl *D) {
     // those because they are always unnamed.
     bool IsZeroSize = Field->isZeroSize(Context);
 
+    // P3074
+    const bool TrivialUnion = Context.getLangOpts().CPlusPlus26 && isUnion();
----------------
Sirraide wrote:

```suggestion
    bool TrivialUnion = Context.getLangOpts().CPlusPlus26 && isUnion();
```
nit (we typically don’t use top-level const for local vars)

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


More information about the cfe-commits mailing list