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

Jason Rice via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 3 10:33:26 PST 2025


================
@@ -422,8 +445,8 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc,
     if (const TemplateTypeParmType *TTP
           = Unexpanded[I].first.dyn_cast<const TemplateTypeParmType *>())
       Name = TTP->getIdentifier();
-    else
-      Name = cast<NamedDecl *>(Unexpanded[I].first)->getIdentifier();
+    else if (NamedDecl *ND = Unexpanded[I].first.dyn_cast<NamedDecl *>())
+      Name = ND->getIdentifier();
----------------
ricejasonf wrote:

It is possible there is a completely different approach that uses BindingDecl more directly as the parameter pack. I think it would still run into issues with BindingDecl not being a VarDecl so the ResolvedUnexpandedPackExpr worked out, but it was part of a more general approach to dealing with packs.

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


More information about the cfe-commits mailing list