[clang] [Clang][Sema] Mark decomposition decl invalid for explicit array type (PR #210964)

Akash Agrawal via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 27 05:34:55 PDT 2026


akashagrwl wrote:

I've reworked this to bail out earlier instead of touching the initialization fast path. ActOnDecompositionDeclarator already marks the declaration invalid for function types ("won't work here"); I've extended that to array types, which are the same case: a structured binding's type is always deduced, so an explicit array bound is meaningless and is exactly what fed a mismatched type into the array-copy path and tripped the assert. Marking the decl invalid means AddInitializerToDecl skips initialization entirely, so no init is performed and we emit only the "must be 'auto'" diagnostic. Record/CTAD types still fall through and keep their useful "binds to N elements" diagnostics, so nothing is lost there.

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


More information about the cfe-commits mailing list