================
@@ -750,8 +750,33 @@ void InitListChecker::FillInEmptyInitForField(unsigned 
Init, FieldDecl *Field,
     if (Field->hasInClassInitializer()) {
       if (VerifyOnly)
         return;
-
-      ExprResult DIE = SemaRef.BuildCXXDefaultInitExpr(Loc, Field);
+      ExprResult DIE;
+      {
+        // Enter a lifetime extension context, then we can support lifetime
+        // extension of temporary created by aggregate initialization using a
+        // default member initializer (DR1815 https://wg21.link/CWG1815).
+        //
+        // In a lifetime extension context, BuildCXXDefaultInitExpr will clone
+        // the initializer expression on each use and the temporaries which
+        // actually bound to a reference member should be extended here.
+        //
+        // FIXME: In default member initializer, lifetime extension context 
will
+        // collect the MaterializedTemporaryExprs which bound to a reference
----------------
yronglin wrote:

I've extend `InLifetimeExtendingContext` flag to resolve this FIXME.

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

Reply via email to