1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuctypedef unsigned int size_t; 4*f4a2713aSLionel Sambuc@protocol P @end 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc@interface NSMutableArray 7*f4a2713aSLionel Sambuc- (id)objectAtIndexedSubscript:(double)index; // expected-note {{parameter of type 'double' is declared here}} 8*f4a2713aSLionel Sambuc- (void)setObject:(id *)object atIndexedSubscript:(void *)index; // expected-note {{parameter of type 'void *' is declared here}} \ 9*f4a2713aSLionel Sambuc // expected-note {{parameter of type 'id *' is declared here}} 10*f4a2713aSLionel Sambuc@end 11*f4a2713aSLionel Sambuc@interface I @end 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambucint main() { 14*f4a2713aSLionel Sambuc NSMutableArray<P> * array; 15*f4a2713aSLionel Sambuc id oldObject = array[10]; // expected-error {{method index parameter type 'double' is not integral type}} 16*f4a2713aSLionel Sambuc array[3] = 0; // expected-error {{method index parameter type 'void *' is not integral type}} \ 17*f4a2713aSLionel Sambuc // expected-error {{cannot assign to this array because assigning method's 2nd parameter of type 'id *' is not an Objective-C pointer type}} 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc I* iarray; 20*f4a2713aSLionel Sambuc iarray[3] = 0; // expected-error {{expected method to write array element not found on object of type 'I *'}} 21*f4a2713aSLionel Sambuc I* p = iarray[4]; // expected-error {{expected method to read array element not found on object of type 'I *'}} 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc oldObject = array[10]++; // expected-error {{illegal operation on Objective-C container subscripting}} 24*f4a2713aSLionel Sambuc oldObject = array[10]--; // expected-error {{illegal operation on Objective-C container subscripting}} 25*f4a2713aSLionel Sambuc oldObject = --array[10]; // expected-error {{illegal operation on Objective-C container subscripting}} 26*f4a2713aSLionel Sambuc} 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambuc@interface NSMutableDictionary 29*f4a2713aSLionel Sambuc- (id)objectForKeyedSubscript:(id*)key; // expected-note {{parameter of type 'id *' is declared here}} 30*f4a2713aSLionel Sambuc- (void)setObject:(void*)object forKeyedSubscript:(id*)key; // expected-note {{parameter of type 'void *' is declared here}} \ 31*f4a2713aSLionel Sambuc // expected-note {{parameter of type 'id *' is declared here}} 32*f4a2713aSLionel Sambuc@end 33*f4a2713aSLionel Sambuc@class NSString; 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambucvoid testDict() { 36*f4a2713aSLionel Sambuc NSMutableDictionary *dictionary; 37*f4a2713aSLionel Sambuc NSString *key; 38*f4a2713aSLionel Sambuc id newObject, oldObject; 39*f4a2713aSLionel Sambuc oldObject = dictionary[key]; // expected-error {{method key parameter type 'id *' is not object type}} 40*f4a2713aSLionel Sambuc dictionary[key] = newObject; // expected-error {{method object parameter type 'void *' is not object type}} \ 41*f4a2713aSLionel Sambuc // expected-error {{method key parameter type 'id *' is not object type}} 42*f4a2713aSLionel Sambuc} 43