Index: lib/Sema/SemaCast.cpp =================================================================== --- lib/Sema/SemaCast.cpp +++ lib/Sema/SemaCast.cpp @@ -1396,7 +1396,8 @@ if (!SrcMemPtr) { msg = diag::err_bad_static_cast_member_pointer_nonmp; return TC_NotApplicable; - } + } else if (Self.Context.getTargetInfo().getCXXABI().isMicrosoft()) + Self.RequireCompleteType(OpRange.getBegin(), SrcType, 0); // T == T, modulo cv if (!Self.Context.hasSameUnqualifiedType(SrcMemPtr->getPointeeType(), Index: lib/Sema/SemaType.cpp =================================================================== --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -6476,7 +6476,7 @@ // We lock in the inheritance model once somebody has asked us to ensure // that a pointer-to-member type is complete. if (Context.getTargetInfo().getCXXABI().isMicrosoft()) { - if (const MemberPointerType *MPTy = T->getAs()) { + if (auto *MPTy = T.getCanonicalType()->getAs()) { if (!MPTy->getClass()->isDependentType()) { RequireCompleteType(Loc, QualType(MPTy->getClass(), 0), 0); assignInheritanceModel(*this, MPTy->getMostRecentCXXRecordDecl()); Index: test/CodeGenCXX/microsoft-abi-member-pointers.cpp =================================================================== --- test/CodeGenCXX/microsoft-abi-member-pointers.cpp +++ test/CodeGenCXX/microsoft-abi-member-pointers.cpp @@ -729,3 +729,20 @@ // CHECK: @"\01??_9C@pr23878@@$BA@AE" to i8*), i32 0, i32 4 DMemPtrTy get_memptr() { return &D::f; } } + +class C {}; + +typedef void (C::*f)(); + +class CA : public C { +public: + void OnHelp(void); + int OnHelp(int); +}; + +// CHECK-LABEL: foo_fun +void foo_fun() { + // CHECK: store i8* bitcast (void (%class.CA*)* @"\01?OnHelp@CA@@QAEXXZ" to i8*), i8** + f func = (f)&CA::OnHelp; +} +