================ @@ -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) ---------------- erichkeane wrote:
Based on the comment, should this be: `if(getIndexExpr().containsErrors()) return std::nullopt;`, then just a `cast`? 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