Skip to content

Commit ec143c1

Browse files
committed
fixup! Switch to checking EvaluationContext
1 parent 4943c26 commit ec143c1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5836,11 +5836,16 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
58365836
// With CWG2369, we substitute constraints before instantiating the associated
58375837
// function template. This helps prevent potential code generation for
58385838
// dependent types, particularly under the MS ABI.
5839-
bool InUnevaluatedOrImmediateContext =
5840-
llvm::any_of(ExprEvalContexts, [](auto &Context) {
5841-
return Context.isUnevaluated() || Context.isImmediateFunctionContext();
5842-
});
5843-
if (!InUnevaluatedOrImmediateContext) {
5839+
bool ShouldSkipCG = [&] {
5840+
auto *RD = dyn_cast<CXXRecordDecl>(Function->getParent());
5841+
if (!RD || !RD->isLambda())
5842+
return false;
5843+
5844+
return llvm::any_of(ExprEvalContexts, [](auto &Context) {
5845+
return Context.isUnevaluated() || Context.isImmediateFunctionContext();
5846+
});
5847+
}();
5848+
if (ShouldSkipCG) {
58445849
DeclGroupRef DG(Function);
58455850
Consumer.HandleTopLevelDecl(DG);
58465851
}

0 commit comments

Comments
 (0)