1// RUN: %clang_cc1 -fsyntax-only -verify %s 2// rdar://10904488 3 4@interface Test 5- (int)objectAtIndexedSubscript:(int)index; // expected-note {{method 'objectAtIndexedSubscript:' declared here}} 6- (void)setObject:(int)object atIndexedSubscript:(int)index; // expected-note {{parameter of type 'int' is declared here}} 7@end 8 9@interface NSMutableDictionary 10- (int)objectForKeyedSubscript:(id)key; // expected-note {{method 'objectForKeyedSubscript:' declared here}} 11- (void)setObject:(int)object forKeyedSubscript:(id)key; // expected-note {{parameter of type 'int' is declared here}} 12@end 13 14int main() { 15 Test *array; 16 int i = array[10]; // expected-error {{method for accessing array element must have Objective-C object return type instead of 'int'}} 17 array[2] = i; // expected-error {{cannot assign to this array because assigning method's 2nd parameter of type 'int' is not an Objective-C pointer type}} 18 19 NSMutableDictionary *dict; 20 id key, val; 21 val = dict[key]; // expected-error {{method for accessing dictionary element must have Objective-C object return type instead of 'int'}} \ 22 // expected-warning {{incompatible integer to pointer conversion assigning to 'id' from 'int'}} 23 dict[key] = val; // expected-error {{method object parameter type 'int' is not object type}} 24} 25 26