[clang] [Clang][Sema] Fix an ICE where structured binding packs within a lambda should be diagnosed immediately (PR #214716)

via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 8 07:07:16 PDT 2026


================
@@ -454,6 +462,11 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc,
       };
       if (llvm::any_of(CSI->LocalPacks, DeclaresThisPack))
         ParamPackReferences.push_back(Pack);
+
+      // Structured binding packs should not participate in delayed lambda
+      // diagnostics, and should instead be diagnosed immediately
----------------
babadany2999 wrote:

You're right. That is a valid pack expansion and the lambda should be allowed to have delayed diagnostics.
According to [[temp.variadic]](https://eel.is/c++draft/temp.variadic), specifically `p6` and `p6.17`:
`[...] Pack expansions can occur in the following contexts:`
- `p6.17`: `In a [fold-expression] ([expr.prim.fold]); the pattern is the [cast-expression] that contains an unexpanded pack`

And by `p8`:
`A pack whose name appears within the pattern of a pack expansion is expanded by that pack expansion[...]` and `An appearance of a name of a pack that is not expanded is ill-formed` (which also proves that #214160 is ill-formed) and from [[expr.prim.fold]](https://eel.is/c++draft/expr.prim.fold) makes it a valid right unary fold.

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


More information about the cfe-commits mailing list