summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/proto-hier-2.m
diff options
context:
space:
mode:
authordpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-21 01:01:14 +0000
committerdpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-21 01:01:14 +0000
commit724dc00277ca01f310bb79bf55cd7098b2ebe7f8 (patch)
tree487ede87395d20bb36a115837b7d1c9b31422c63 /gcc/testsuite/objc.dg/proto-hier-2.m
parent805892cfda9b76da114ec4fc44bce5a5a763991b (diff)
downloadgcc-724dc00277ca01f310bb79bf55cd7098b2ebe7f8.tar.gz
2002-08-20 Devang Patel <dpatel@apple.com>
* tree.c (get_qualified_type): Add TYPE_CONTEXT check. testsuite: * objc.dg/proto-hier-2.m: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56475 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/objc.dg/proto-hier-2.m')
-rw-r--r--gcc/testsuite/objc.dg/proto-hier-2.m49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/proto-hier-2.m b/gcc/testsuite/objc.dg/proto-hier-2.m
new file mode 100644
index 00000000000..453de89e5bf
--- /dev/null
+++ b/gcc/testsuite/objc.dg/proto-hier-2.m
@@ -0,0 +1,49 @@
+/* Test protocol warning. */
+/* Contributed by Devang Patel <dpatel@apple.com>. */
+/* { dg-do compile } */
+
+typedef struct objc_object { struct objc_class *class_pointer; } *id;
+
+@protocol Bar
+@end
+
+id <Bar> Foo_Bar () { }
+
+typedef struct
+{
+ int i;
+} MyStruct;
+
+@interface Foo
+{
+ id _mainData;
+ MyStruct *_anotherData;
+}
+
+-(id) mainDataSource;
+-(id) anotherDataSource;
+-(id) my_method: (int) i;
+@end
+
+@implementation Foo
+-(id) anotherDataSource
+{
+ return (id)_anotherData;
+}
+
+-(id) mainDataSource
+{
+ return _mainData;
+}
+
+-(id) my_method: (int) i
+{
+ id one = [self anotherDataSource];
+
+ i = i - 1;
+ // Do not issue warning about my_method not implemented by protocol
+ return [(one ? [self mainDataSource] : one) my_method:i];
+}
+
+@end
+