brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1001 B · 6ec8d9c Raw
46 lines · plain
1// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin %s -o /dev/null2 3typedef unsigned int size_t;4@protocol P @end5 6@interface NSMutableArray7#if __has_feature(objc_subscripting)8- (id)objectAtIndexedSubscript:(size_t)index;9- (void)setObject:(id)object atIndexedSubscript:(size_t)index;10#endif11@end12 13#if __has_feature(objc_subscripting)14@interface XNSMutableArray15- (id)objectAtIndexedSubscript:(size_t)index;16- (void)setObject:(id)object atIndexedSubscript:(size_t)index;17#endif18@end19 20@interface NSMutableDictionary21- (id)objectForKeyedSubscript:(id)key;22- (void)setObject:(id)object forKeyedSubscript:(id)key;23@end24 25@class NSString;26 27int main(void) {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 newObject43 44}45 46