[clang] [clang][bytecode] Don't implicitly begin union member lifetime... (PR #192212)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 15 02:19:24 PDT 2026


================
@@ -5609,6 +5610,8 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) {
     assert(Args.size() == 2);
     IsAssignmentOperatorCall = true;
     std::reverse(Args.begin(), Args.end());
+    const CXXRecordDecl *LHSRecord = Args[0]->getType()->getAsCXXRecordDecl();
+    ActivateLHS = !LHSRecord || LHSRecord->hasTrivialDefaultConstructor();
----------------
Endilll wrote:

Shouldn't this be
```suggestion
    ActivateLHS = LHSRecord && LHSRecord->hasTrivialDefaultConstructor();
```

If not, we need a test where `LHSRecord` is `nullptr`. I'm very curious how it would look like and why we should accept it.

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


More information about the cfe-commits mailing list