diff options
Diffstat (limited to 'test/SemaObjC/objc-literal-nsnumber.m')
-rw-r--r-- | test/SemaObjC/objc-literal-nsnumber.m | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaObjC/objc-literal-nsnumber.m b/test/SemaObjC/objc-literal-nsnumber.m index a2d37282b716..57bc07b139e9 100644 --- a/test/SemaObjC/objc-literal-nsnumber.m +++ b/test/SemaObjC/objc-literal-nsnumber.m @@ -9,6 +9,24 @@ typedef unsigned int NSUInteger; typedef int NSInteger; #endif +void checkNSNumberUnavailableDiagnostic() { + id num = @1000; // expected-error {{NSNumber must be available to use Objective-C literals}} + + int x = 1000; + id num1 = @(x); // expected-error {{NSNumber must be available to use Objective-C literals}}\ + // expected-error {{illegal type 'int' used in a boxed expression}} +} + +@class NSNumber; + +void checkNSNumberFDDiagnostic() { + id num = @1000; // expected-error {{NSNumber must be available to use Objective-C literals}} + + int x = 1000; + id num1 = @(x); // expected-error {{declaration of 'numberWithInt:' is missing in NSNumber class}}\ + // expected-error {{illegal type 'int' used in a boxed expression}} +} + @interface NSObject + (NSObject*)nsobject; @end |