[clang] [Clang][Sema] Properly get captured 'this' pointer in lambdas with an explicit object parameter in constant evaluator (PR #81102)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 13 09:51:31 PDT 2024
================
@@ -9037,45 +9055,46 @@ class PointerExprEvaluator
return Error(E);
}
bool VisitCXXThisExpr(const CXXThisExpr *E) {
- // Can't look at 'this' when checking a potential constant expression.
- if (Info.checkingPotentialConstantExpression())
- return false;
- if (!Info.CurrentCall->This) {
+ auto DiagnoseInvalidUseOfThis = [&] {
if (Info.getLangOpts().CPlusPlus11)
Info.FFDiag(E, diag::note_constexpr_this) << E->isImplicit();
else
Info.FFDiag(E);
+ };
+
+ // Can't look at 'this' when checking a potential constant expression.
+ if (Info.checkingPotentialConstantExpression())
return false;
+
+ const bool IsExplicitLambda =
----------------
AaronBallman wrote:
```suggestion
bool IsExplicitLambda =
```
https://github.com/llvm/llvm-project/pull/81102
More information about the cfe-commits
mailing list