Fariborz Jahanian | a78eca2 | 2012-03-28 17:56:49 +0000 | [diff] [blame] | 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 | |
Jordan Rose | b13291a | 2012-07-19 18:10:18 +0000 | [diff] [blame] | 30 | dict["name"] = @666; // expected-error {{indexing expression is invalid because subscript type 'char *' is not an Objective-C pointer}} |
Fariborz Jahanian | a78eca2 | 2012-03-28 17:56:49 +0000 | [diff] [blame] | 31 | |
| 32 | return 0; |
| 33 | } |
| 34 | |