================
@@ -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);
 
----------------
bazuzi wrote:

This actually causes crashes in the case of array initialization with one 
element, where the element type is a RecordType.

Minimal repro:
```
struct S {};

void target() { S foo[] = {S()}; }
```

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