[all-commits] [llvm/llvm-project] 3ed9e9: [Clang] Add captures to the instantiation scope of...
cor3ntin via All-commits
all-commits at lists.llvm.org
Fri Sep 8 08:50:43 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3ed9e9e3ace6f9ce320cf4e75cffa04a7c7241b5
https://github.com/llvm/llvm-project/commit/3ed9e9e3ace6f9ce320cf4e75cffa04a7c7241b5
Author: Corentin Jabot <corentinjabot at gmail.com>
Date: 2023-09-08 (Fri, 08 Sep 2023)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Sema/Sema.h
M clang/lib/Sema/SemaConcept.cpp
M clang/lib/Sema/SemaDecl.cpp
M clang/lib/Sema/SemaLambda.cpp
M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
M clang/lib/Sema/TreeTransform.h
M clang/test/SemaCXX/lambda-capture-type-deduction.cpp
A clang/test/SemaCXX/this-type-deduction-concept.cpp
Log Message:
-----------
[Clang] Add captures to the instantiation scope of lambda call operators
Like concepts checking, a trailing return type of a lambda
in a dependent context may refer to captures in which case
they may need to be rebuilt, so the map of local decl
should include captures.
This patch reveal a pre-existing issue.
`this` is always recomputed by TreeTransform.
`*this` (like all captures) only become `const`
after the parameter list.
However, if try to recompute the value of `this` (in a parameter)
during template instantiation while determining the type of the call operator,
we will determine it to be const (unless the lambda is mutable).
There is no good way to know at that point that we are in a parameter
or not, the easiest/best solution is to transform the type of this.
Note that doing so break a handful of HLSL tests.
So this is a prototype at this point.
Fixes #65067
Fixes #63675
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D159126
More information about the All-commits
mailing list