brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 3d2a132 Raw
25 lines · plain
1// RUN: %clang_cc1  -fsyntax-only -verify %s2 3@interface Test4- (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@end7 8@interface NSMutableDictionary9- (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@end12 13int 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 25