]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaObjC/objc-dictionary-literal.m
Vendor import of clang trunk r161861:
[FreeBSD/FreeBSD.git] / test / SemaObjC / objc-dictionary-literal.m
1 // RUN: %clang_cc1  -fsyntax-only -verify %s
2 // rdar://11062080
3
4 @interface NSNumber
5 + (NSNumber *)numberWithChar:(char)value;
6 + (NSNumber *)numberWithInt:(int)value;
7 @end
8
9 @protocol NSCopying @end
10 typedef unsigned long NSUInteger;
11 typedef long NSInteger;
12
13 @interface NSDictionary
14 + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id <NSCopying> [])keys count:(NSUInteger)cnt;
15 - (void)setObject:(id)object forKeyedSubscript:(id)key;
16 @end
17
18 @interface NSString<NSCopying>
19 @end
20
21 @interface NSArray
22 - (id)objectAtIndexedSubscript:(NSInteger)index;
23 - (void)setObject:(id)object atIndexedSubscript:(NSInteger)index;
24 @end
25
26 int main() {
27         NSDictionary *dict = @{ @"name":@666 };
28         dict[@"name"] = @666;
29
30         dict["name"] = @666; // expected-error {{indexing expression is invalid because subscript type 'char *' is not an Objective-C pointer}}
31
32         return 0;
33 }
34