================
@@ -535,7 +535,19 @@ class TransferVisitor : public 
ConstStmtVisitor<TransferVisitor> {
         return;
 
       copyRecord(*LocSrc, *LocDst, Env);
-      Env.setStorageLocation(*S, *LocDst);
+
+      // If the expr is a glvalue, we can reasonably assume the operator is
+      // returning T& and thus we can assign it `LocDst`.
+      if (S->isGLValue()) {
+        Env.setStorageLocation(*S, *LocDst);
+      } else if (S->getType()->isRecordType()) {
+        // If the expr is a prvalue, we cannot really assume anything regarding
+        // the new value being created. We should just propagate it to ensure a
+        // `RecordValue` exist for it.
----------------
martinboehme wrote:

The "propagate" wording is misleading. Here's a suggestion based on the 
equivalent code in `VisitCallExpr()`:

```suggestion
        // Make sure that we have a `RecordValue` for this expression so that
        // `Environment::getResultObjectLocation()` is able to return a location
        // for it.
```

https://github.com/llvm/llvm-project/pull/80991
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to