Fariborz Jahanian | ba0afde | 2012-03-28 17:56:49 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | // rdar://11062080 |
Fariborz Jahanian | e1e33f8 | 2013-11-01 21:58:17 +0000 | [diff] [blame^] | 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 |
Fariborz Jahanian | ba0afde | 2012-03-28 17:56:49 +0000 | [diff] [blame] | 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 | |
Jordan Rose | 96c49686 | 2012-07-19 18:10:18 +0000 | [diff] [blame] | 32 | dict["name"] = @666; // expected-error {{indexing expression is invalid because subscript type 'char *' is not an Objective-C pointer}} |
Fariborz Jahanian | ba0afde | 2012-03-28 17:56:49 +0000 | [diff] [blame] | 33 | |
| 34 | return 0; |
| 35 | } |
| 36 | |