1 /* Test for situations in which protocol conformance information
2 may be lost while casting. */
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;
20 Obj <Proto> *objrcvr2;
22 /* NB: Since 'receiver' is an invalid ObjC message receiver, the compiler
23 should warn but then search for methods as if we were messaging 'id'. */
25 receiver += [receiver someValue]; /* { dg-warning "invalid receiver type .long int." } */
26 receiver += [receiver anotherValue]; /* { dg-warning "invalid receiver type .long int." } */
28 receiver += [(Obj *)receiver someValue]; /* { dg-warning ".Obj. may not respond to .\\-someValue." } */
29 /* { dg-warning "assignment makes integer from pointer without a cast" "" { target *-*-* } 28 } */
31 receiver += [(Obj *)receiver anotherValue];
32 receiver += [(Obj <Proto> *)receiver someValue];
33 receiver += [(Obj <Proto> *)receiver anotherValue];
34 receiver += [objrcvr someValue]; /* { dg-warning ".Obj. may not respond to .\\-someValue." } */
35 /* { dg-warning "assignment makes integer from pointer without a cast" "" { target *-*-* } 34 } */
37 receiver += [objrcvr anotherValue];
38 receiver += [(Obj <Proto> *)objrcvr someValue];
39 receiver += [(Obj <Proto> *)objrcvr anotherValue];
40 receiver += [objrcvr2 someValue];
41 receiver += [objrcvr2 anotherValue];
42 receiver += [(Obj *)objrcvr2 someValue]; /* { dg-warning ".Obj. may not respond to .\\-someValue." } */
43 /* { dg-warning "assignment makes integer from pointer without a cast" "" { target *-*-* } 42 } */
45 receiver += [(Obj *)objrcvr2 anotherValue];
50 /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */
51 /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */
52 /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */