[all-commits] [llvm/llvm-project] c86c81: [Sema] Fix lifetime extension for temporaries in r...

Marco Vitale via All-commits all-commits at lists.llvm.org
Wed Jul 9 18:57:29 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c86c815fc57c098ba14576fe2bb189da1dfc820d
      https://github.com/llvm/llvm-project/commit/c86c815fc57c098ba14576fe2bb189da1dfc820d
  Author: Marco Vitale <53484928+mrcvtl at users.noreply.github.com>
  Date:   2025-07-10 (Thu, 10 Jul 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/Decl.h
    M clang/lib/Sema/CheckExprLifetime.cpp
    M clang/lib/Sema/SemaStmt.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    M clang/lib/Serialization/ASTWriterDecl.cpp
    M clang/test/SemaCXX/attr-lifetimebound.cpp
    A clang/test/SemaCXX/range-for-lifetime-cxx23.cpp

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

C++23 mandates that temporaries used in range-based for loops are
lifetime-extended
to cover the full loop. This patch adds a check for loop variables and
compiler-
generated `__range` bindings to apply the correct extension.

Includes test cases based on examples from CWG900/P2644R1.

Fixes https://github.com/llvm/llvm-project/issues/109793



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list