summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/comp-types-13.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/comp-types-13.mm')
-rw-r--r--gcc/testsuite/obj-c++.dg/comp-types-13.mm19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-13.mm b/gcc/testsuite/obj-c++.dg/comp-types-13.mm
new file mode 100644
index 000000000..3a919d5d0
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/comp-types-13.mm
@@ -0,0 +1,19 @@
+/* When assigning function pointers, allow for covariant return types
+ and contravariant argument types. */
+/* { dg-do compile } */
+#include <objc/Object.h>
+
+@class Derived;
+
+Object *ExternFunc (Object *filePath, Object *key);
+typedef id FuncSignature (Object *arg1, Derived *arg2);
+
+@interface Derived: Object
++ (void)registerFunc:(FuncSignature *)function;
+@end
+
+void foo(void)
+{
+ [Derived registerFunc: ExternFunc];
+}
+