[clang] [Clang][C++26] Implement Pack Indexing (P2662R3). (PR #72644)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 05:29:01 PST 2024


================
@@ -1665,6 +1665,43 @@ NonTypeTemplateParmDecl *SubstNonTypeTemplateParmExpr::getParameter() const {
       getReplacedTemplateParameterList(getAssociatedDecl())->asArray()[Index]);
 }
 
+PackIndexingExpr *PackIndexingExpr::Create(ASTContext &Context,
+                                           SourceLocation EllipsisLoc,
+                                           SourceLocation RSquareLoc,
+                                           Expr *PackIdExpr, Expr *IndexExpr,
+                                           std::optional<int64_t> Index,
+                                           ArrayRef<Expr *> SubstitutedExprs) {
+  QualType Type;
+  if (Index && !SubstitutedExprs.empty())
----------------
cor3ntin wrote:

We can get into a situation where the index is no longer dependent, but the pack itself still is. This is why there is this check. the type is dependent until both the index and are expanded

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


More information about the cfe-commits mailing list