brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 7c417eb Raw
49 lines · plain
1// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp2// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp3 4typedef unsigned long size_t;5 6void *sel_registerName(const char *);7 8@protocol P @end9 10@interface NSMutableArray11#if __has_feature(objc_subscripting)12- (id)objectAtIndexedSubscript:(size_t)index;13- (void)setObject:(id)object atIndexedSubscript:(size_t)index;14#endif15@end16 17#if __has_feature(objc_subscripting)18@interface XNSMutableArray19- (id)objectAtIndexedSubscript:(size_t)index;20- (void)setObject:(id)object atIndexedSubscript:(size_t)index;21#endif22@end23 24@interface NSMutableDictionary25- (id)objectForKeyedSubscript:(id)key;26- (void)setObject:(id)object forKeyedSubscript:(id)key;27@end28 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 newObject47}48 49