[clang] [clang][AST] Invalidate DecompositionDecl if it has invalid initializer. (PR #72428)
Henrik G. Olsson via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 17 02:51:36 PST 2023
hnrklssn wrote:
> > What differentiates the DecompositionDecl such that we need to mark the decl invalid when there's an error in the RHS, while for other decls we don't? It seems inconsistent.
>
>
>
> DecompositionDecl (aka structure binding) is special here, a legal DecompositionDecl must be declared with a deduced `auto` type, so the its initializer should play part of the decl's invalid bit. For the error case where a DecompositionDecl with a non-deduced type, clang still builds the Decl AST node (with invalid bit) for better recovery. There are some oversight cases. This patch is fixing those.
Ah that makes sense then. I didn't realise it had to be `auto`.
https://github.com/llvm/llvm-project/pull/72428
More information about the cfe-commits
mailing list