[clang] [Clang][Concepts] Fix the constraint equivalence checking involving parameter packs (PR #102131)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 23 23:49:13 PDT 2024


================
@@ -972,8 +972,15 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
   // equivalence.
   LocalInstantiationScope ScopeForParameters(S);
   if (auto *FD = DeclInfo.getDecl()->getAsFunction())
-    for (auto *PVD : FD->parameters())
-      ScopeForParameters.InstantiatedLocal(PVD, PVD);
+    for (auto *PVD : FD->parameters()) {
+      if (!PVD->isParameterPack()) {
+        ScopeForParameters.InstantiatedLocal(PVD, PVD);
+        continue;
+      }
+      // Parameter packs should expand to a size-of-1 argument.
+      ScopeForParameters.MakeInstantiatedLocalArgPack(PVD);
+      ScopeForParameters.InstantiatedLocalPackArg(PVD, PVD);
+    }
----------------
mizvekov wrote:

Actually, I think the better (future) approach here would be to ditch this scope and improve how FindInstantiatedDecl figures out which declarations should be part of the context being instantiated, and which are outside, so that it just naturally doesn't try to transform these declarations, just as for example it doesn't transform declarations at a template level above the context being instantiated.

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


More information about the cfe-commits mailing list