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

Jason Rice via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 2 11:13:01 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:

ResolvedUnexpandedPackExpr is not directly associated with a name. My original implementation was not for structured bindings so it is a little more general.

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


More information about the cfe-commits mailing list