[clang] [Clang][Concepts] Fix a constraint comparison regression for out-of-line ClassTemplateDecls (PR #102587)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 21:15:52 PDT 2024


================
@@ -971,9 +971,12 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
   // this may happen while we're comparing two templates' constraint
   // equivalence.
   LocalInstantiationScope ScopeForParameters(S);
-  if (auto *FD = DeclInfo.getDecl()->getAsFunction())
-    for (auto *PVD : FD->parameters())
-      ScopeForParameters.InstantiatedLocal(PVD, PVD);
+  if (const NamedDecl *D = DeclInfo.getDecl()) {
+    const FunctionDecl *FD = D->getAsFunction();
----------------
zyn0217 wrote:

(I roughly explained in the comment.)
This function `SubstituteConstraintExpressionWithoutSatisfaction` would be called in the context where a template parameter list is getting parsed, when the template declaration that the template parameter list would attach to is not yet available.

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


More information about the cfe-commits mailing list