Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1  -fsyntax-only -verify %s
      2 // rdar://11062080
      3 // RUN: %clang_cc1  -fsyntax-only -triple i386-apple-macosx10.9.0 -fobjc-runtime=macosx-fragile-10.9.0 -fobjc-subscripting-legacy-runtime -verify %s
      4 // rdar://15363492
      5 
      6 @interface NSNumber
      7 + (NSNumber *)numberWithChar:(char)value;
      8 + (NSNumber *)numberWithInt:(int)value;
      9 @end
     10 
     11 @protocol NSCopying @end
     12 typedef unsigned long NSUInteger;
     13 typedef long NSInteger;
     14 
     15 @interface NSDictionary
     16 + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id <NSCopying> [])keys count:(NSUInteger)cnt;
     17 - (void)setObject:(id)object forKeyedSubscript:(id)key;
     18 @end
     19 
     20 @interface NSString<NSCopying>
     21 @end
     22 
     23 @interface NSArray
     24 - (id)objectAtIndexedSubscript:(NSInteger)index;
     25 - (void)setObject:(id)object atIndexedSubscript:(NSInteger)index;
     26 @end
     27 
     28 int main() {
     29 	NSDictionary *dict = @{ @"name":@666 };
     30         dict[@"name"] = @666;
     31 
     32         dict["name"] = @666; // expected-error {{indexing expression is invalid because subscript type 'char *' is not an Objective-C pointer}}
     33 
     34 	return 0;
     35 }
     36 
     37