1 /* Test for situations in which protocol conformance information
2 may be lost, leading to superfluous warnings. */
3 /* Author: Ziemowit Laski <zlaski@apple.com>. */
4 /* { dg-do compile } */
6 /* One-line substitute for objc/objc.h */
7 typedef struct objc_object { struct objc_class *class_pointer; } *id;
13 @interface NSObject <NSObject>
16 @protocol PlateMethods
21 NSObject <PlateMethods> *plate;
22 id <PlateMethods> plate1;
25 - (id <PlateMethods>) getPlate;
26 - (id <NSObject>) getPlate1;
31 - (id <PlateMethods>) getPlate {
32 return plate; /* { dg-bogus "does not implement" } */
34 - (id <NSObject>) getPlate1 {
35 return (id <NSObject>)plate1; /* { dg-bogus "does not conform" } */
38 int i = [plate1 someValue]; /* { dg-warning ".\\-someValue. not implemented by protocol\\(s\\)" } */
39 /* { dg-warning "\\(Messages without a matching method signature" "" { target *-*-* } 38 } */
40 /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 38 } */
41 /* { dg-warning ".\.\.\.. as arguments\.\\)" "" { target *-*-* } 38 } */
42 /* { dg-warning "initialization makes integer from pointer without a cast" "" { target *-*-* } 38 } */
44 int j = [(id <NSObject>)plate1 someValue]; /* { dg-bogus "not implemented by protocol" } */
45 int k = [(id)plate1 someValue]; /* { dg-bogus "not implemented by protocol" } */