================
@@ -648,6 +648,12 @@ class TransferVisitor : public 
ConstStmtVisitor<TransferVisitor> {
     QualType Type = S->getType();
 
     if (!Type->isStructureOrClassType()) {
+      // It is possible that InitListExpr is not a prvalue, in which case
+      // `setValue` will fail. In this case, we can just let the next
+      // transfer function handle the value creation.
+      if (!S->isPRValue())
+        return;
+
       if (auto *Val = Env.createValue(Type))
         Env.setValue(*S, *Val);
 
----------------
martinboehme wrote:
Looking at this, I'm surprised that (in the existing prvalue case) we don't 
handle this better -- we should be able to propagate the actual value instead 
of creating a value from scratch.

I think you can handle both the prvalue and the glvalue case by simply doing 
this:

```suggestion
      assert(S->getNumInits() == 1);
      propagateValueOrStorageLocation(*S->getInit(0), *S, Env);
```

If this works, can you extend the test to verify that the value of `test` is 
`false`?

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

Reply via email to