================
@@ -1230,11 +1230,26 @@ CodeGenFunction::EmitCXXForRangeStmt(const 
CXXForRangeStmt &S,
   JumpDest LoopExit = getJumpDestInCurrentScope("for.end");
 
   LexicalScope ForScope(*this, S.getSourceRange());
+  const DeclStmt *RangeDS = cast<DeclStmt>(S.getRangeStmt());
+  const VarDecl *RangeVar = cast<VarDecl>(RangeDS->getSingleDecl());
+  if (getLangOpts().CPlusPlus23)
----------------
efriedma-quic wrote:

Oh, so it's actually supposed to say "If a temporary expression is bound to a 
reference member from a default member initializer, and that member initializer 
is used by a constructor, the constructor is ill-formed" or something like 
that?  I guess that makes sense in context, but the language could be improved.

Back to the issue we were discussing here, when are the destructors for 
non-lifetime-extended temporaries supposed to run?  If they're supposed to stay 
live for the whole expression, probably the rewriting code in Sema should just 
rewrite out the ExprWithCleanups.

If they're supposed to be destroyed, you might need to add a special-case to 
ExprWithCleanups handling to special-case the cleanups for the temporaries that 
are supposed to be lifetime-extended.  (If you're going to touch this code, 
make sure you're working on latest main, since #85398 landed recently.)

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

Reply via email to