1 | // RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin %s -o /dev/null |
2 | |
3 | typedef unsigned int size_t; |
4 | @protocol P @end |
5 | |
6 | @interface NSMutableArray |
7 | #if __has_feature(objc_subscripting) |
8 | - (id)objectAtIndexedSubscript:(size_t)index; |
9 | - (void)setObject:(id)object atIndexedSubscript:(size_t)index; |
10 | #endif |
11 | @end |
12 | |
13 | #if __has_feature(objc_subscripting) |
14 | @interface XNSMutableArray |
15 | - (id)objectAtIndexedSubscript:(size_t)index; |
16 | - (void)setObject:(id)object atIndexedSubscript:(size_t)index; |
17 | #endif |
18 | @end |
19 | |
20 | @interface NSMutableDictionary |
21 | - (id)objectForKeyedSubscript:(id)key; |
22 | - (void)setObject:(id)object forKeyedSubscript:(id)key; |
23 | @end |
24 | |
25 | @class NSString; |
26 | |
27 | int main() { |
28 | NSMutableArray<P> * array; |
29 | id oldObject = array[10]; |
30 | |
31 | array[10] = oldObject; |
32 | |
33 | id unknown_array; |
34 | oldObject = unknown_array[1]; |
35 | |
36 | unknown_array[1] = oldObject; |
37 | |
38 | NSMutableDictionary *dictionary; |
39 | NSString *key; |
40 | id newObject; |
41 | oldObject = dictionary[key]; |
42 | dictionary[key] = newObject; // replace oldObject with newObject |
43 | |
44 | } |
45 | |
46 | |