aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/comp-types-11.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/comp-types-11.mm')
-rw-r--r--gcc/testsuite/obj-c++.dg/comp-types-11.mm30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-11.mm b/gcc/testsuite/obj-c++.dg/comp-types-11.mm
new file mode 100644
index 00000000000..9e7d31d49e7
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/comp-types-11.mm
@@ -0,0 +1,30 @@
+/* APPLE LOCAL file mainline */
+/* { dg-do compile } */
+
+
+#include <objc/Object.h>
+
+@protocol Foo
+- (id)meth1;
+- (id)meth2:(int)arg;
+@end
+
+@interface Derived1: Object
+@end
+
+@interface Derived2: Object
++ (Derived1 *)new;
+@end
+
+id<Foo> func(void) {
+ Object *o = [Object new];
+ return o; /* { dg-warning "class .Object. does not implement the .Foo. protocol" } */
+}
+
+@implementation Derived2
++ (Derived1 *)new {
+ Derived2 *o = [super new];
+ return o; /* { dg-warning "distinct Objective\\-C type in return" } */
+}
+@end
+