1// RUN: %clang_cc1  -fsyntax-only -verify %s
2// rdar://10111397
3
4#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
5typedef unsigned long NSUInteger;
6#else
7typedef unsigned int NSUInteger;
8#endif
9
10@class NSString;
11
12extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
13
14@class NSFastEnumerationState;
15
16@protocol NSFastEnumeration
17
18- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id [])buffer count:(NSUInteger)len;
19
20@end
21
22@interface NSNumber 
23+ (NSNumber *)numberWithInt:(int)value;
24@end
25
26@interface NSArray <NSFastEnumeration>
27+ (id)arrayWithObjects:(const id [])objects count:(NSUInteger)cnt;
28@end
29
30
31int main() {
32 NSArray *array = @[@"Hello", @"There", @"How Are You", [NSNumber numberWithInt:42]];
33
34  for (id string in array)
35    NSLog(@"%@\n", string);
36
37  NSArray *array1 = @["Forgot"]; // expected-error {{string literal must be prefixed by '@' in a collection}}
38
39  const char *blah;
40  NSArray *array2 = @[blah]; // expected-error{{collection element of type 'const char *' is not an Objective-C object}}
41}
42