1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp 2*f4a2713aSLionel Sambuc// 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*f4a2713aSLionel Sambuc// rdar://11203853 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuctypedef unsigned long size_t; 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambucvoid *sel_registerName(const char *); 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc@protocol P @end 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc@interface NSMutableArray 12*f4a2713aSLionel Sambuc#if __has_feature(objc_subscripting) 13*f4a2713aSLionel Sambuc- (id)objectAtIndexedSubscript:(size_t)index; 14*f4a2713aSLionel Sambuc- (void)setObject:(id)object atIndexedSubscript:(size_t)index; 15*f4a2713aSLionel Sambuc#endif 16*f4a2713aSLionel Sambuc@end 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc#if __has_feature(objc_subscripting) 19*f4a2713aSLionel Sambuc@interface XNSMutableArray 20*f4a2713aSLionel Sambuc- (id)objectAtIndexedSubscript:(size_t)index; 21*f4a2713aSLionel Sambuc- (void)setObject:(id)object atIndexedSubscript:(size_t)index; 22*f4a2713aSLionel Sambuc#endif 23*f4a2713aSLionel Sambuc@end 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc@interface NSMutableDictionary 26*f4a2713aSLionel Sambuc- (id)objectForKeyedSubscript:(id)key; 27*f4a2713aSLionel Sambuc- (void)setObject:(id)object forKeyedSubscript:(id)key; 28*f4a2713aSLionel Sambuc@end 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc@class NSString; 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambucint main() { 33*f4a2713aSLionel Sambuc NSMutableArray<P> * array; 34*f4a2713aSLionel Sambuc id oldObject = array[10]; 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc array[10] = oldObject; 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc id unknown_array; 39*f4a2713aSLionel Sambuc oldObject = unknown_array[1]; 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc unknown_array[1] = oldObject; 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambuc NSMutableDictionary *dictionary; 44*f4a2713aSLionel Sambuc NSString *key; 45*f4a2713aSLionel Sambuc id newObject; 46*f4a2713aSLionel Sambuc oldObject = dictionary[key]; 47*f4a2713aSLionel Sambuc dictionary[key] = newObject; // replace oldObject with newObject 48*f4a2713aSLionel Sambuc} 49*f4a2713aSLionel Sambuc 50