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