[clang] [clang][AST] Invalidate DecompositionDecl if it has invalid initializer. (PR #72428)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 17 02:23:06 PST 2023


hokein 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.

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


More information about the cfe-commits mailing list