[PATCH] D11828: [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 20:29:46 PDT 2015
ABataev updated the summary for this revision.
ABataev updated this revision to Diff 31631.
ABataev added a comment.
Update after review
http://reviews.llvm.org/D11828
Files:
lib/Sema/SemaCast.cpp
test/CodeGenCXX/microsoft-abi-member-pointers.cpp
Index: lib/Sema/SemaCast.cpp
===================================================================
--- lib/Sema/SemaCast.cpp
+++ lib/Sema/SemaCast.cpp
@@ -1397,6 +1397,8 @@
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(),
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 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;
+}
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11828.31631.patch
Type: text/x-patch
Size: 1140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150810/804bb865/attachment.bin>
More information about the cfe-commits
mailing list