r244428 - [MSVC] Crash fix: assigning of overloaded member function pointer caused assertion
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 9 21:07:51 PDT 2015
Author: abataev
Date: Sun Aug 9 23:07:49 2015
New Revision: 244428
URL: http://llvm.org/viewvc/llvm-project?rev=244428&view=rev
Log:
[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
Modified:
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=244428&r1=244427&r2=244428&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Sun Aug 9 23:07:49 2015
@@ -1397,6 +1397,8 @@ TryStaticMemberPointerUpcast(Sema &Self,
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(),
Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp?rev=244428&r1=244427&r2=244428&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp Sun Aug 9 23:07:49 2015
@@ -729,3 +729,20 @@ typedef void (D::*DMemPtrTy)();
// CHECK: @"\01??_9C at pr23878@@$BA at 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 at CA@@QAEXXZ" to i8*), i8**
+ f func = (f)&CA::OnHelp;
+}
+
More information about the cfe-commits
mailing list