================ @@ -414,7 +414,7 @@ let Class = PropertyTypeCase<APValue, "Union"> in { let Read = [{ node.getUnionValue() }]; } def : Creator<[{ - return APValue(cast<clang::FieldDecl>(fieldDecl), std::move(value)); + return APValue(cast_if_present<clang::FieldDecl>(fieldDecl), std::move(value)); ---------------- hokein wrote:
Adding more context since it wasn’t obvious to me at first glance — In the ASTWriter, the `fieldDecl` is written as `ap_value_node.getUnionField()`, and `getUnionField()` may return a nullptr, so in the ASTReader here, we need to handle the nullptr case to construct a null-field-decl `APValue`. https://github.com/llvm/llvm-project/pull/140179 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits