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