================ @@ -757,23 +775,40 @@ bool Sema::CheckParameterPacksForExpansion( bool HaveFirstPack = false; std::optional<unsigned> NumPartialExpansions; SourceLocation PartiallySubstitutedPackLoc; + typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack; for (UnexpandedParameterPack ParmPack : Unexpanded) { // Compute the depth and index for this parameter pack. unsigned Depth = 0, Index = 0; IdentifierInfo *Name; bool IsVarDeclPack = false; + ResolvedUnexpandedPackExpr *ResolvedPack = nullptr; if (const TemplateTypeParmType *TTP = ParmPack.first.dyn_cast<const TemplateTypeParmType *>()) { Depth = TTP->getDepth(); Index = TTP->getIndex(); Name = TTP->getIdentifier(); + } else if (auto *RP = + ParmPack.first.dyn_cast<ResolvedUnexpandedPackExpr *>()) { + ResolvedPack = RP; } else { NamedDecl *ND = cast<NamedDecl *>(ParmPack.first); if (isa<VarDecl>(ND)) IsVarDeclPack = true; - else + else if (isa<BindingDecl>(ND)) { + // Find the instantiated BindingDecl and check it for a resolved pack. + llvm::PointerUnion<Decl *, DeclArgumentPack *> *Instantiation = + CurrentInstantiationScope->findInstantiationOf(ND); + Decl *B = cast<Decl *>(*Instantiation); + Expr *BindingExpr = cast<BindingDecl>(B)->getBinding(); + ResolvedPack = + dyn_cast_if_present<ResolvedUnexpandedPackExpr>(BindingExpr); + if (!ResolvedPack) { + ShouldExpand = false; + continue; + } ---------------- zyn0217 wrote:
Oh yes indeed. I missed something in CheckCompleteDecompositionDeclaration() - we wouldn't create ResolvedUnexpandedPackExpr for dependent types. https://github.com/llvm/llvm-project/pull/121417 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits