[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 16 21:55:35 PST 2025


================
@@ -50,17 +50,29 @@ class CollectUnexpandedParameterPacksVisitor
         auto *FTD = FD ? FD->getDescribedFunctionTemplate() : nullptr;
         if (FTD && FTD->getTemplateParameters()->getDepth() >= DepthLimit)
           return;
-      } else if (getDepthAndIndex(ND).first >= DepthLimit)
+      } else if (auto *BD = dyn_cast<BindingDecl>(ND)) {
+        Expr *E = BD->getBinding();
+        if (auto *RP = dyn_cast_if_present<ResolvedUnexpandedPackExpr>(E)) {
+          addUnexpanded(RP);
+          return;
+        }
----------------
zyn0217 wrote:

I was thinking if we can get rid of the `dyn_cast_if_present` thing..
Do you have a case where we ended up in `addUnexpanded` with a BindingDecl whose binding isn't a ResolvedUnexpandedPackExpr?

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


More information about the cfe-commits mailing list