================
@@ -5337,6 +5317,11 @@ class InitListTransformer {
     if (auto *RD = Ty->getAsCXXRecordDecl()) {
       llvm::SmallVector<CXXRecordDecl *> RecordDecls;
       RecordDecls.push_back(RD);
+      // If this is a prvalue create an xvalue so the member accesses
+      // will be xvalues.
+      if (E->isPRValue())
+        E = new (Ctx)
+            MaterializeTemporaryExpr(Ty, E, /*BoundToLvalueReference=*/false);
----------------
llvm-beanz wrote:

I noted in conversation with @spall that this does produce a bunch of extra 
temporaries that the optimizer needs to clean up. I think it's fine because it 
is _correct_, and it preserves our AST representation as valid C++ 
initializers. If this causes performance issues we can address it then.

https://github.com/llvm/llvm-project/pull/186233
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to