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

Jason Rice via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 26 18:52:02 PST 2025


================
@@ -1523,9 +1570,25 @@ void Sema::CheckCompleteDecompositionDeclaration(DecompositionDecl *DD) {
   // If the type of the decomposition is dependent, then so is the type of
   // each binding.
   if (DecompType->isDependentType()) {
-    for (auto *B : DD->bindings())
-      B->setType(Context.DependentTy);
+    for (auto *B : DD->bindings()) {
+      // Do not overwrite any pack type.
+      if (B->getType().isNull())
+        B->setType(Context.DependentTy);
+    }
----------------
ricejasonf wrote:

This was here before. After processing the intializer the BindingDecls should all have types set except in the case when the initializer is dependent. In that case all the types are still Null so here we set them to dependent. My change is just preventing it from overwriting the PackExpansionType if there is one.

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


More information about the cfe-commits mailing list