[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 28 09:13:07 PDT 2025


================
@@ -2374,6 +2374,9 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init,
       SemaRef.ObjC().inferObjCARCLifetime(Decl))
     Decl->setInvalidDecl();
 
+  if (SemaRef.getLangOpts().CPlusPlus23)
----------------
yronglin wrote:

I think we don't need this change. We already has a flag in `VarDecl`.

https://github.com/llvm/llvm-project/pull/145164


More information about the cfe-commits mailing list