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/TestsuiteObject.h"
9 - (id)initWithData:(TestsuiteObject *)data;
13 - (id)initWithData:(int)data;
17 - (id)initWithData:(id<MyObject, MyCoding>)data;
20 @interface NTGridDataObject: TestsuiteObject <MyCoding>
22 TestsuiteObject<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-message "using .\\-\\(id\\)initWithData:\\(TestsuiteObject \\*\\)data." "" { target *-*-* } 9 } */
36 /* { dg-message "also found .\\-\\(id\\)initWithData:\\(id <MyObject, MyCoding>\\)data." "" { target *-*-* } 17 } */
37 /* { dg-message "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 } */