blob: fb5c79fd8437dbf40a64fcde6557d2b8e077ca58 [file] [log] [blame]
Ted Kremenekebcb57a2012-03-06 20:05:56 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2typedef _Bool BOOL;
3
4@interface NSNumber @end
5
6@interface NSNumber (NSNumberCreation)
7+ (NSNumber *)numberWithChar:(char)value;
8+ (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
9+ (NSNumber *)numberWithShort:(short)value;
10+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
11+ (NSNumber *)numberWithInt:(int)value;
12+ (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
13+ (NSNumber *)numberWithLong:(long)value;
14+ (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
15+ (NSNumber *)numberWithLongLong:(long long)value;
16+ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
17+ (NSNumber *)numberWithFloat:(float)value;
18+ (NSNumber *)numberWithDouble:(double)value;
19+ (int)numberWithBool:(BOOL)value; // expected-note{{method returns unexpected type 'int' (should be an object type)}}
20@end
21
22@interface NSArray
23@end
24
25@interface NSArray (NSArrayCreation)
26+ (id)arrayWithObjects:(const int [])objects // expected-note{{first parameter has unexpected type 'const int *' (should be 'const id *')}}
27 count:(unsigned long)cnt;
28@end
29
30@interface NSDictionary
31+ (id)dictionaryWithObjects:(const id [])objects
32 forKeys:(const int [])keys // expected-note{{second parameter has unexpected type 'const int *' (should be 'const id *')}}
33 count:(unsigned long)cnt;
34@end
35
36void test_sig() {
37 (void)@__objc_yes; // expected-error{{literal construction method 'numberWithBool:' has incompatible signature}}
38 id array = @[ @17 ]; // expected-error{{literal construction method 'arrayWithObjects:count:' has incompatible signature}}
39 id dict = @{ @"hello" : @17 }; // expected-error{{literal construction method 'dictionaryWithObjects:forKeys:count:' has incompatible signature}}
40}