diff options
Diffstat (limited to 'test/SemaTemplate/instantiate-objc-1.mm')
-rw-r--r-- | test/SemaTemplate/instantiate-objc-1.mm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-objc-1.mm b/test/SemaTemplate/instantiate-objc-1.mm index 2780f8e..f8b97eb 100644 --- a/test/SemaTemplate/instantiate-objc-1.mm +++ b/test/SemaTemplate/instantiate-objc-1.mm @@ -46,3 +46,24 @@ template <typename T> struct EncodeTest { template struct EncodeTest<int>; template struct EncodeTest<double>; template struct EncodeTest<wchar_t>; + +// @() boxing expressions. +template <typename T> struct BoxingTest { + static id box(T value) { + return @(value); // expected-error {{illegal type 'int *' used in a boxed expression}} \ + // expected-error {{illegal type 'long double' used in a boxed expression}} + } +}; + +@interface NSNumber ++ (NSNumber *)numberWithInt:(int)value; +@end + +@interface NSString ++ (id)stringWithUTF8String:(const char *)str; +@end + +template struct BoxingTest<int>; +template struct BoxingTest<const char *>; +template struct BoxingTest<int *>; // expected-note {{in instantiation of member function 'BoxingTest<int *>::box' requested here}} +template struct BoxingTest<long double>; // expected-note {{in instantiation of member function 'BoxingTest<long double>::box' requested here}} |