Index: lib/AST/ASTImporter.cpp =================================================================== --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -6085,9 +6085,13 @@ if (!ToMember && E->getMemberDecl()) return nullptr; - DeclAccessPair ToFoundDecl = DeclAccessPair::make( - dyn_cast(Importer.Import(E->getFoundDecl().getDecl())), - E->getFoundDecl().getAccess()); + auto *ToDecl = + dyn_cast_or_null(Importer.Import(E->getFoundDecl().getDecl())); + if (!ToDecl && E->getFoundDecl().getDecl()) + return nullptr; + + DeclAccessPair ToFoundDecl = + DeclAccessPair::make(ToDecl, E->getFoundDecl().getAccess()); DeclarationNameInfo ToMemberNameInfo( Importer.Import(E->getMemberNameInfo().getName()),