blob: 9d86d88bcbec10eb727dd2d7499704b89775814f [file] [log] [blame]
Fariborz Jahanianba0afde2012-03-28 17:56:49 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2// rdar://11062080
Fariborz Jahaniane1e33f82013-11-01 21:58:17 +00003// 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
Fariborz Jahanianba0afde2012-03-28 17:56:49 +00005
6@interface NSNumber
7+ (NSNumber *)numberWithChar:(char)value;
8+ (NSNumber *)numberWithInt:(int)value;
9@end
10
11@protocol NSCopying @end
12typedef unsigned long NSUInteger;
13typedef 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
28int main() {
29 NSDictionary *dict = @{ @"name":@666 };
30 dict[@"name"] = @666;
31
Jordan Rose96c496862012-07-19 18:10:18 +000032 dict["name"] = @666; // expected-error {{indexing expression is invalid because subscript type 'char *' is not an Objective-C pointer}}
Fariborz Jahanianba0afde2012-03-28 17:56:49 +000033
34 return 0;
35}
36