================ @@ -1061,6 +1070,59 @@ ExprResult Sema::ActOnSizeofParameterPackExpr(Scope *S, RParenLoc); } +static bool isParameterPack(Expr *PackExpression) { + if (auto D = dyn_cast<DeclRefExpr>(PackExpression); D) { + ValueDecl *VD = D->getDecl(); + return VD->isParameterPack(); + } + return false; +} + +ExprResult Sema::ActOnPackIndexingExpr(Scope *S, Expr *PackExpression, + SourceLocation EllipsisLoc, + SourceLocation LSquareLoc, + Expr *IndexExpr, + SourceLocation RSquareLoc) { + bool isParameterPack = ::isParameterPack(PackExpression); + if (!isParameterPack) { + CorrectDelayedTyposInExpr(IndexExpr); + Diag(PackExpression->getBeginLoc(), diag::err_expected_name_of_pack) + << PackExpression; + return ExprError(); + } + return BuildPackIndexingExpr(PackExpression, EllipsisLoc, IndexExpr, + RSquareLoc); +} + +ExprResult +Sema::BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, + Expr *IndexExpr, SourceLocation RSquareLoc, + ArrayRef<Expr *> ExpandedExprs, bool EmptyPack) { + + std::optional<int64_t> Index; + if (!IndexExpr->isValueDependent() && !IndexExpr->isTypeDependent()) { ---------------- erichkeane wrote:
isn't this just `isInstantiationDependent`? https://github.com/llvm/llvm-project/pull/72644 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits