|
16 | 16 |
|
17 | 17 | #include "clang/APINotes/APINotesManager.h" |
18 | 18 | #include "clang/AST/ASTFwd.h" |
| 19 | +#include "clang/AST/ASTLambda.h" |
19 | 20 | #include "clang/AST/Attr.h" |
20 | 21 | #include "clang/AST/AttrIterator.h" |
21 | 22 | #include "clang/AST/CharUnits.h" |
@@ -13108,14 +13109,16 @@ class Sema final : public SemaBase { |
13108 | 13109 | ? ExpressionEvaluationContext::ImmediateFunctionContext |
13109 | 13110 | : ExpressionEvaluationContext::PotentiallyEvaluated); |
13110 | 13111 | if (FD) { |
| 13112 | + auto &Current = S.currentEvaluationContext(); |
| 13113 | + const auto &Parent = S.parentEvaluationContext(); |
| 13114 | + |
13111 | 13115 | FD->setWillHaveBody(true); |
13112 | | - S.ExprEvalContexts.back().InImmediateFunctionContext = |
| 13116 | + Current.InImmediateFunctionContext = |
13113 | 13117 | FD->isImmediateFunction() || |
13114 | | - S.ExprEvalContexts[S.ExprEvalContexts.size() - 2] |
13115 | | - .isConstantEvaluated() || |
13116 | | - S.ExprEvalContexts[S.ExprEvalContexts.size() - 2] |
13117 | | - .isImmediateFunctionContext(); |
13118 | | - S.ExprEvalContexts.back().InImmediateEscalatingFunctionContext = |
| 13118 | + (isLambdaMethod(FD) && (Parent.isConstantEvaluated() || |
| 13119 | + Parent.isImmediateFunctionContext())); |
| 13120 | + |
| 13121 | + Current.InImmediateEscalatingFunctionContext = |
13119 | 13122 | S.getLangOpts().CPlusPlus20 && FD->isImmediateEscalating(); |
13120 | 13123 | } else |
13121 | 13124 | assert(isa<ObjCMethodDecl>(DC)); |
|
0 commit comments