When parsing a C++17 binding declaration, we first create the
BindingDecls in Sema::ActOnDecompositionDeclarator, and then build the
DecompositionDecl in Sema::ActOnVariableDeclarator, so the contained
BindingDecls are never null. But when deserializing, we read the
DecompositionDecl first, do a few with all properations on it, and only later readties before filling in the Bindings.
One of those operations is potentially marking the DecompositionDecl as
invalidAmong other things, and Decl::setInvalidDecl was propagating that to thereading a declaration reads whether it's invalid,
BindingDecls that don't yet exist, causing a crash when deserializingthen calling setInvalidDecl which assumes that all bindings of the
invalid DecompositionDeclsDecompositionDecl are available, but that isn't the case.
One way would be to change that function, but I believe this is better,
because the parsing code path is tested more thoroughly and sticking to
the same order for (de-)serialization makes the assumptions one wouldDeserialization should just set all properties directly without invoking
derive from the parsing code apply here as wellsubsequent functions, so we just set the flag without using the setter.