[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 8 02:24:54 PDT 2024


================
@@ -1144,6 +1164,46 @@ bool Sema::CheckInstantiatedFunctionTemplateConstraints(
                                      PointOfInstantiation, Satisfaction);
 }
 
+bool Sema::CheckFunctionConstraintsWithoutInstantiation(
+    SourceLocation PointOfInstantiation, FunctionTemplateDecl *Template,
+    ArrayRef<TemplateArgument> TemplateArgs,
+    ConstraintSatisfaction &Satisfaction) {
+  FunctionDecl *FD = Template->getTemplatedDecl();
+  SmallVector<const Expr *, 3> TemplateAC;
+  Template->getAssociatedConstraints(TemplateAC);
+  if (TemplateAC.empty()) {
+    Satisfaction.IsSatisfied = true;
+    return false;
+  }
+
+  // Enter the scope of this instantiation. We don't use
+  // PushDeclContext because we don't have a scope.
+  LocalInstantiationScope Scope(*this);
----------------
zyn0217 wrote:

Removed. This comment was copied elsewhere, and I think the very original meaning was that "we don't have a parser Scope so we have to use something else."

https://github.com/llvm/llvm-project/pull/102857


More information about the cfe-commits mailing list