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