================ @@ -3767,6 +3767,57 @@ void DependentDecltypeType::Profile(llvm::FoldingSetNodeID &ID, E->Profile(ID, Context, true); } +PackIndexingType::PackIndexingType(const ASTContext &Context, + QualType Canonical, QualType Pattern, + Expr *IndexExpr, + ArrayRef<QualType> Expansions) + : Type(PackIndexing, Canonical, + computeDependence(Pattern, IndexExpr, Expansions)), + Context(Context), Pattern(Pattern), IndexExpr(IndexExpr), + Size(Expansions.size()) { + + std::uninitialized_copy(Expansions.begin(), Expansions.end(), + getTrailingObjects<QualType>()); +} + +std::optional<unsigned> PackIndexingType::getSelectedIndex() const { + if (isInstantiationDependentType()) + return std::nullopt; + // Should only be not a constant for error recovery. + ConstantExpr *CE = dyn_cast<ConstantExpr>(getIndexExpr()); + if (!CE) ---------------- cor3ntin wrote:
``` int i = 0; using foo = pack...[i]; ``` We need to somehow parse that (if we fail to parse it it's going to at best not be classified as a type), but i is not a constant expression. So it's error recovery in the general sense, not a RecoveryExpr 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