[clang] [Clang] Do not try emitting function body when substituting a constraint (PR #186380)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 11 11:53:29 PDT 2026
================
@@ -5977,20 +5965,12 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
savedContext.pop();
}
- // We never need to emit the code for a lambda in unevaluated context.
- // We also can't mangle a lambda in the require clause of a function template
- // during constraint checking as the MSI ABI would need to mangle the (not yet
- // specialized) enclosing declaration
- // FIXME: Should we try to skip this for non-lambda functions too?
- bool ShouldSkipCG = [&] {
- auto *RD = dyn_cast<CXXRecordDecl>(Function->getParent());
- if (!RD || !RD->isLambda())
- return false;
-
- return llvm::any_of(ExprEvalContexts, [](auto &Context) {
- return Context.isUnevaluated() || Context.isImmediateFunctionContext();
- });
- }();
+ // We never need to emit the code in constriant substitution.
+ // For example, we can't mangle a lambda in the require clause of a function
+ // template during constraint checking as the MS ABI would need to mangle the
+ // (not yet specialized) enclosing declaration.
+ // FIXME: This can be removed when MS ABI supports concepts.
+ bool ShouldSkipCG = inConstraintSubstitution();
----------------
zyn0217 wrote:
The problem occurs when codegen of MSABI happens.
So maybe we want the opposite, but the CI does suggest someone wants such codegen during concept checking. (or some instantiation triggered from concept checking)
https://github.com/llvm/llvm-project/pull/186380
More information about the cfe-commits
mailing list