[clang] [Sema] Fix lifetime extension for temporaries in range-based for loops in C++23 (PR #145164)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 3 02:14:00 PDT 2025
================
@@ -1304,6 +1304,13 @@ checkExprLifetimeImpl(Sema &SemaRef, const InitializedEntity *InitEntity,
if (LK == LK_FullExpression)
return;
+ if (LK == LK_Extended && SemaRef.getLangOpts().CPlusPlus23) {
----------------
hokein wrote:
Is the `LK == LK_Extended` check necessary here? I think we can simply bail out in this case, regardless of the LK value.
https://github.com/llvm/llvm-project/pull/145164
More information about the cfe-commits
mailing list