[clang] [Clang][Concepts] Fix the constraint equivalence checking involving parameter packs (PR #102131)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 24 00:09:08 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);
+ }
----------------
zyn0217 wrote:
Thanks for the suggestion; I’m offline and will add more comments when I get to my computer.
IIRC, this future improvement could also benefit noexcept specifier comparison as it also requires an instantiation scope that just indicates, “We know this declaration is not instantiated; just go on and leave it an uninstantiated state”
Isolating the declaration instantiation from a TreeTransform seems to have inconvenienced other things. Maybe that is what was designed for templates in the first place, but it becomes cumbersome for cases like this and CWG2369, etc, and we need the on-demand instantiation.
https://github.com/llvm/llvm-project/pull/102131
More information about the cfe-commits
mailing list