+2002-08-20 Devang Patel <dpatel@apple.com>
+ * tree.c (get_qualified_type): Add TYPE_CONTEXT check.
+
2002-08-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* arc.c (output_shift): Use stdio instead of asm_fprintf.
+2002-08-20 Devang Patel <dpatel@apple.com>
+ * objc.dg/proto-hier-2.m: New test.
+
2002-08-19 Ziemowit Laski <zlaski@apple.com>
* objc.dg/bitfield-1.m: New test.
--- /dev/null
+/* 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
+
like the one we need to have. If so, use that existing one. We must
preserve the TYPE_NAME, since there is code that depends on this. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
- if (TYPE_QUALS (t) == type_quals && TYPE_NAME (t) == TYPE_NAME (type))
+ if (TYPE_QUALS (t) == type_quals && TYPE_NAME (t) == TYPE_NAME (type)
+ && TYPE_CONTEXT (t) == TYPE_CONTEXT (type))
return t;
return NULL_TREE;