[clang] [Clang] Avoid quadratic pack-indexing instantiation (store only the selected element) (PR #213790)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 5 02:31:07 PDT 2026


================
@@ -398,8 +398,10 @@ ExprDependence clang::computeDependence(PackIndexingExpr *E) {
     D |= PatternDep | ExprDependence::Instantiation;
   else if (!E->getIndexExpr()->isInstantiationDependent()) {
     UnsignedOrNone Index = E->getSelectedIndex();
-    assert(Index && *Index < Exprs.size() && "pack index out of bound");
-    D |= Exprs[*Index]->getDependence();
+    assert(Index && "pack index out of bound");
+    unsigned SelIdx = Exprs.size() == 1 ? 0 : *Index;
----------------
zyn0217 wrote:

SelectedIndex

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


More information about the cfe-commits mailing list