1// RUN: %clang_cc1 -Wstrict-selector-match -fsyntax-only -verify %s 2 3@interface Foo 4-(int) method; // expected-note {{using}} 5@end 6 7@interface Bar 8-(float) method; // expected-note {{also found}} 9@end 10 11int main() { [(id)0 method]; } // expected-warning {{multiple methods named 'method' found}} 12 13@interface Object @end 14 15@interface Class1 16- (void)setWindow:(Object *)wdw; // expected-note {{using}} 17@end 18 19@interface Class2 20- (void)setWindow:(Class1 *)window; // expected-note {{also found}} 21@end 22 23id foo(void) { 24 Object *obj = 0; 25 id obj2 = obj; 26 [obj setWindow:0]; // expected-warning {{Object' may not respond to 'setWindow:'}} 27 [obj2 setWindow:0]; // expected-warning {{multiple methods named 'setWindow:' found}} 28 return obj; 29} 30 31@protocol MyObject 32- (id)initWithData:(Object *)data; // expected-note {{using}} 33@end 34 35@protocol SomeOther 36- (id)initWithData:(int)data; // expected-note {{also found}} 37@end 38 39@protocol MyCoding 40- (id)initWithData:(id<MyObject, MyCoding>)data; // expected-note {{also found}} 41@end 42 43@interface NTGridDataObject: Object <MyCoding> 44{ 45 Object<MyCoding> *_data; 46} 47+ (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data; 48@end 49 50@implementation NTGridDataObject 51- (id)initWithData:(id<MyObject, MyCoding>)data { 52 return data; 53} 54+ (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data 55{ 56 NTGridDataObject *result = [(id)0 initWithData:data]; // expected-warning {{multiple methods named 'initWithData:' found}} 57 return result; 58} 59@end 60 61@interface Base 62- (unsigned)port; 63@end 64 65@interface Derived: Base 66- (Object *)port; 67+ (Protocol *)port; 68@end 69 70void foo1(void) { 71 [(Class)0 port]; // OK - gcc issues warning but there is only one Class method so no ambiguity to warn 72} 73 74