blob: 549cfde20250ab28049644abb6ba6c1a97a80282 [file] [log] [blame]
Ted Kremenekb3f75422012-03-06 20:06:06 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2// RUN: cp %s %t
3// RUN: not %clang_cc1 -fsyntax-only -fixit -x objective-c %t
4// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x objective-c %t
Ted Kremenekb3f75422012-03-06 20:06:06 +00005
6typedef unsigned char BOOL;
7
Jordan Rose9f63a452012-06-08 21:14:25 +00008@interface NSObject
Jordan Rose9f63a452012-06-08 21:14:25 +00009@end
Ted Kremenekb3f75422012-03-06 20:06:06 +000010
Jordan Rose9f63a452012-06-08 21:14:25 +000011@interface NSNumber : NSObject
Ted Kremenekb3f75422012-03-06 20:06:06 +000012+ (NSNumber *)numberWithChar:(char)value;
13+ (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
14+ (NSNumber *)numberWithShort:(short)value;
15+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
16+ (NSNumber *)numberWithInt:(int)value;
17+ (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
18+ (NSNumber *)numberWithLong:(long)value;
19+ (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
20+ (NSNumber *)numberWithLongLong:(long long)value;
21+ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
22+ (NSNumber *)numberWithFloat:(float)value;
23+ (NSNumber *)numberWithDouble:(double)value;
24+ (NSNumber *)numberWithBool:(BOOL)value;
25@end
26
Jordan Rose9f63a452012-06-08 21:14:25 +000027@interface NSArray : NSObject
Ted Kremenekb3f75422012-03-06 20:06:06 +000028+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt;
29@end
30
Jordan Rose9f63a452012-06-08 21:14:25 +000031@interface NSDictionary : NSObject
Ted Kremenekb3f75422012-03-06 20:06:06 +000032+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
33@end
34
Jordan Rose9f63a452012-06-08 21:14:25 +000035@interface NSString : NSObject
36@end
37
Ted Kremenekb3f75422012-03-06 20:06:06 +000038void fixes() {
39 id arr = @[
40 17, // expected-error{{numeric literal must be prefixed by '@' in a collection}}
41 'a', // expected-error{{character literal must be prefixed by '@'}}
42 "blah" // expected-error{{string literal must be prefixed by '@'}}
43 ];
44}