summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/fwd-proto-1.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/fwd-proto-1.m')
-rw-r--r--gcc/testsuite/objc.dg/fwd-proto-1.m29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/fwd-proto-1.m b/gcc/testsuite/objc.dg/fwd-proto-1.m
new file mode 100644
index 000000000..3b21c513c
--- /dev/null
+++ b/gcc/testsuite/objc.dg/fwd-proto-1.m
@@ -0,0 +1,29 @@
+/* Test forward-decls for @protocols. */
+/* Author: Ziemowit Laski <zlaski@apple.com>. */
+/* { dg-do compile } */
+
+/* One-line substitute for objc/objc.h */
+typedef struct objc_object { struct objc_class *class_pointer; } *id;
+
+@protocol Bar;
+@protocol Boo;
+
+@protocol Foo
+- (id <Bar>)someMethod;
+- (id <Baz>)anotherMethod; /* { dg-error "annot find protocol declaration" } */
+@end
+
+@protocol Bar <Boo>
+- (id <Foo>)someOtherMethod;
+- (id <Baz>)anotherMethod; /* { dg-error "annot find protocol declaration" } */
+- (id <Boo>)yetAnotherMethod;
+@end
+
+/* The following worthy test is stubbed out until we can get the
+ harness to match correctly on the "compilation terminated" message
+ when running on GNU/Linux. sts 2001-08-01 */
+#if 0
+@protocol Boo <Bar> /* { /*dg*/-error "has circular dependency" } */
+@end
+#endif
+