1 /* Check if finding multiple signatures for a method is handled gracefully
2 when method lookup succeeds (see also method-7.m). */
3 /* Contributed by Ziemowit Laski <zlaski@apple.com> */
5 /* { dg-do compile } */
6 /* { dg-options "-Wstrict-selector-match" } */
8 #include <objc/Object.h>
11 - (id)initWithData:(Object *)data;
15 - (id)initWithData:(int)data;
19 - (id)initWithData:(id<MyObject, MyCoding>)data;
22 @interface NTGridDataObject: Object <MyCoding>
24 Object<MyCoding> *_data;
26 + (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data;
29 @implementation NTGridDataObject
30 - (id)initWithData:(id<MyObject, MyCoding>)data {
33 + (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data
35 NTGridDataObject *result = [[NTGridDataObject alloc] initWithData:data];
36 /* { dg-warning "multiple methods named .\\-initWithData:. found" "" { target *-*-* } 35 } */
37 /* { dg-warning "using .\\-\\(id\\)initWithData:\\(Object \\*\\)data." "" { target *-*-* } 11 } */
38 /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(id <MyObject, MyCoding>\\)data." "" { target *-*-* } 19 } */
39 /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(int\\)data." "" { target *-*-* } 15 } */
41 /* The following warning is a consequence of picking the "wrong" method signature. */
42 /* { dg-warning "passing argument 1 of .initWithData:. from distinct Objective\\-C type" "" { target *-*-* } 35 } */