1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s 2f4a2713aSLionel Sambuc// rdar://11062080 3f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -triple i386-apple-macosx10.9.0 -fobjc-runtime=macosx-fragile-10.9.0 -fobjc-subscripting-legacy-runtime -verify %s 4f4a2713aSLionel Sambuc// rdar://15363492 5f4a2713aSLionel Sambuc 6*0a6a1f1dSLionel Sambuc#define nil ((void *)0) 7*0a6a1f1dSLionel Sambuc 8f4a2713aSLionel Sambuc@interface NSNumber 9f4a2713aSLionel Sambuc+ (NSNumber *)numberWithChar:(char)value; 10f4a2713aSLionel Sambuc+ (NSNumber *)numberWithInt:(int)value; 11f4a2713aSLionel Sambuc@end 12f4a2713aSLionel Sambuc 13f4a2713aSLionel Sambuc@protocol NSCopying @end 14f4a2713aSLionel Sambuctypedef unsigned long NSUInteger; 15f4a2713aSLionel Sambuctypedef long NSInteger; 16f4a2713aSLionel Sambuc 17f4a2713aSLionel Sambuc@interface NSDictionary 18f4a2713aSLionel Sambuc+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id <NSCopying> [])keys count:(NSUInteger)cnt; 19f4a2713aSLionel Sambuc- (void)setObject:(id)object forKeyedSubscript:(id)key; 20*0a6a1f1dSLionel Sambuc- (id)objectForKeyedSubscript:(id)key; 21f4a2713aSLionel Sambuc@end 22f4a2713aSLionel Sambuc 23f4a2713aSLionel Sambuc@interface NSString<NSCopying> 24f4a2713aSLionel Sambuc@end 25f4a2713aSLionel Sambuc 26f4a2713aSLionel Sambuc@interface NSArray 27f4a2713aSLionel Sambuc- (id)objectAtIndexedSubscript:(NSInteger)index; 28f4a2713aSLionel Sambuc- (void)setObject:(id)object atIndexedSubscript:(NSInteger)index; 29f4a2713aSLionel Sambuc@end 30f4a2713aSLionel Sambuc 31*0a6a1f1dSLionel Sambucvoid *pvoid; 32f4a2713aSLionel Sambucint main() { 33f4a2713aSLionel Sambuc NSDictionary *dict = @{ @"name":@666 }; 34f4a2713aSLionel Sambuc dict[@"name"] = @666; 35f4a2713aSLionel Sambuc 36f4a2713aSLionel Sambuc dict["name"] = @666; // expected-error {{indexing expression is invalid because subscript type 'char *' is not an Objective-C pointer}} 37f4a2713aSLionel Sambuc 38*0a6a1f1dSLionel Sambuc // rdar://18254621 39*0a6a1f1dSLionel Sambuc [@{@"foo" : @"bar"} objectForKeyedSubscript:nil]; 40*0a6a1f1dSLionel Sambuc (void)@{@"foo" : @"bar"}[nil]; 41*0a6a1f1dSLionel Sambuc [@{@"foo" : @"bar"} objectForKeyedSubscript:pvoid]; 42*0a6a1f1dSLionel Sambuc (void)@{@"foo" : @"bar"}[pvoid]; 43*0a6a1f1dSLionel Sambuc 44*0a6a1f1dSLionel Sambuc [@{@"foo" : @"bar"} setObject:nil forKeyedSubscript:@"gorf"]; 45*0a6a1f1dSLionel Sambuc @{@"foo" : @"bar"}[nil] = @"gorf"; 46*0a6a1f1dSLionel Sambuc [@{@"foo" : @"bar"} setObject:pvoid forKeyedSubscript:@"gorf"]; 47*0a6a1f1dSLionel Sambuc @{@"foo" : @"bar"}[pvoid] = @"gorf"; 48*0a6a1f1dSLionel Sambuc 49f4a2713aSLionel Sambuc return 0; 50f4a2713aSLionel Sambuc} 51f4a2713aSLionel Sambuc 52