[PATCH] D158433: [Clang] Do not change the type of captured vars when checking lambda constraints
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 22 00:04:18 PDT 2023
cor3ntin added inline comments.
================
Comment at: clang/lib/Sema/SemaConcept.cpp:722
+ const_cast<CXXMethodDecl *>(cast<CXXMethodDecl>(FD)));
+ // Captures are not checked from within the lambda.
+ LSI->AfterParameterList = false;
----------------
shafik wrote:
> This comment does not really explain to me the effect of `LSI->AfterParameterList = false;`
`AfterParameterList` affects in which context we look for captured variables. I will try to think of a better comment.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:19754
+
+ // When evaluating some attributes (like enable_if) we might refer to a
+ // function parameter appertaining to the same declaration as that
----------------
shafik wrote:
> Why move this block of code for?
`isVariableAlreadyCapturedInScopeInfo` is kinda badly name because it will adjust `DeclRefType` by adding `const` as necessary.
if we capture a parameter, and then use it in a concept - which are not checked from within the scope of the lambda, we need to add const to it, which we can only do by reordering these paths. It's a bit subtle, and could do with some improvement as I'm not sure parameters will always be const correct in attributes currently.
But I tried to do a minimal fix
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158433/new/
https://reviews.llvm.org/D158433
More information about the cfe-commits
mailing list