[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)
Marco Vitale via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 1 12:51:07 PDT 2025
================
@@ -1304,6 +1304,13 @@ checkExprLifetimeImpl(Sema &SemaRef, const InitializedEntity *InitEntity,
if (LK == LK_FullExpression)
return;
+ if (LK == LK_Extended && SemaRef.getLangOpts().CPlusPlus23) {
----------------
mrcvtl wrote:
both this and the previous if condition can also be moved in the switch case after the temporary visitor. No strong opinion here.
https://github.com/llvm/llvm-project/pull/145164
More information about the cfe-commits
mailing list