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