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