[clang] [Clang] Recover GLTemplateParameterList for generic lambdas in RebuildLambdaScopeInfo (PR #118176)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 2 07:01:00 PST 2024
================
@@ -15504,10 +15504,25 @@ LambdaScopeInfo *Sema::RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator) {
LSI->CallOperator = CallOperator;
LSI->Lambda = LambdaClass;
LSI->ReturnType = CallOperator->getReturnType();
- // This function in calls in situation where the context of the call operator
- // is not entered, so we set AfterParameterList to false, so that
+ // When this function is called in situation where the context of the call
+ // operator is not entered, we set AfterParameterList to false, so that
// `tryCaptureVariable` finds explicit captures in the appropriate context.
- LSI->AfterParameterList = false;
+ //
+ // There is also at least a situation as in FinishTemplateArgumentDeduction(),
+ // where we would set the CurContext to the lambda operator before
+ // substituting into it. In this case the flag needs to be true such that
+ // tryCaptureVariable can correctly handle potential captures thereof.
+ LSI->AfterParameterList = CurContext == CallOperator;
+ // GLTemplateParameterList is necessary for getCurGenericLambda() which is
----------------
erichkeane wrote:
I would like a new-line right above this comment (after the actual source), as it makes it REALLY easy to miss that line of code here.
https://github.com/llvm/llvm-project/pull/118176
More information about the cfe-commits
mailing list