Allow downcasts of pointers to Objective-C interfaces, with a
warning. This matches GCC's behavior and addresses
<rdar://problem/6458293>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61246 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjCXX/overload.mm b/test/SemaObjCXX/overload.mm
index 16a36fc..0accb46 100644
--- a/test/SemaObjCXX/overload.mm
+++ b/test/SemaObjCXX/overload.mm
@@ -45,6 +45,11 @@
// int& i3 = h(b); FIXME: we match GCC here, but shouldn't this work?
}
+void downcast_test(A* a) {
+ B* b = a; // expected-warning{{incompatible pointer types initializing 'B *', expected 'A *'}}
+ b = a; // expected-warning{{incompatible pointer types assigning 'B *', expected 'A *'}}
+}
+
int& cv(A*);
float& cv(const A*);
int& cv2(void*);