blob: d6bb9c2eb31ddcc3117edb49e98a3b4c07797434 [file] [log] [blame]
Fariborz Jahanian88ec6102012-04-10 22:06:54 +00001// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
2// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3// rdar://11203853
4
5void *sel_registerName(const char *);
6
7typedef unsigned int size_t;
8@protocol P @end
9
10@interface NSMutableArray
11#if __has_feature(objc_subscripting)
12- (id)objectAtIndexedSubscript:(size_t)index;
13- (void)setObject:(id)object atIndexedSubscript:(size_t)index;
14#endif
15@end
16
17#if __has_feature(objc_subscripting)
18@interface XNSMutableArray
19- (id)objectAtIndexedSubscript:(size_t)index;
20- (void)setObject:(id)object atIndexedSubscript:(size_t)index;
21#endif
22@end
23
24@interface NSMutableDictionary
25- (id)objectForKeyedSubscript:(id)key;
26- (void)setObject:(id)object forKeyedSubscript:(id)key;
27@end
28
29@class NSString;
30
31int main() {
32 NSMutableArray<P> * array;
33 id oldObject = array[10];
34
35 array[10] = oldObject;
36
37 id unknown_array;
38 oldObject = unknown_array[1];
39
40 unknown_array[1] = oldObject;
41
42 NSMutableDictionary *dictionary;
43 NSString *key;
44 id newObject;
45 oldObject = dictionary[key];
46 dictionary[key] = newObject; // replace oldObject with newObject
47}
48