[all-commits] [llvm/llvm-project] 158f4f: [Clang] Do not change the type of captured vars wh...

cor3ntin via All-commits all-commits at lists.llvm.org
Thu Aug 24 07:10:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 158f4f30adb4bfd390057742a32934e4344e8fd3
      https://github.com/llvm/llvm-project/commit/158f4f30adb4bfd390057742a32934e4344e8fd3
  Author: Corentin Jabot <corentinjabot at gmail.com>
  Date:   2023-08-24 (Thu, 24 Aug 2023)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaConcept.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/SemaCXX/lambda-capture-type-deduction.cpp

  Log Message:
  -----------
  [Clang] Do not change the type of captured vars when checking lambda constraints

When checking the constraint of a lambda, we need to respect the constness
of the call operator when establishing the type of capture variables.

In D124351, this was done by adding const to the captured variable...
However, that would change the type of the variable outside of the scope
of the lambda, which is clearly not the desired outcome.

Instead, to ensure const-correctness, we need to populate
a LambdaScopeInfo with the capture variables before checking the
constraints of a generic lambda.

There is no changelog as I'd like to tentatively propose we backport
this change to RC3 as it is a regression introduced in the Clang 17
cycle.

Fixes #61267

Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D158433




More information about the All-commits mailing list