forked from OSchip/llvm-project
[MSVC] Crash fix: assigning of overloaded member function pointer caused assertion
Original class was not marked with inheritance attribute and it causes a crash on codegen. Differential Revision: http://reviews.llvm.org/D11828 llvm-svn: 244428
This commit is contained in:
parent
4b81164810
commit
a93fb5b048
|
@ -1397,6 +1397,8 @@ TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType,
|
|||
msg = diag::err_bad_static_cast_member_pointer_nonmp;
|
||||
return TC_NotApplicable;
|
||||
}
|
||||
if (Self.Context.getTargetInfo().getCXXABI().isMicrosoft())
|
||||
Self.RequireCompleteType(OpRange.getBegin(), SrcType, 0);
|
||||
|
||||
// T == T, modulo cv
|
||||
if (!Self.Context.hasSameUnqualifiedType(SrcMemPtr->getPointeeType(),
|
||||
|
|
|
@ -729,3 +729,20 @@ typedef void (D::*DMemPtrTy)();
|
|||
// 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue