1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Obj-C string literal expressions
4 template <typename T> struct StringTest {
10 template struct StringTest<int>;
11 template struct StringTest<double>;
13 // @selector expressions
14 template <typename T> struct SelectorTest {
16 return @selector(multiple:arguments:);
19 return @selector(multiple:arguments:);
23 template struct SelectorTest<int>;
24 template struct SelectorTest<double>;
26 // @protocol expressions
30 template <typename T> struct ProtocolTest {
36 template struct ProtocolTest<int>;
37 template struct ProtocolTest<double>;
39 // @encode expressions
40 template <typename T> struct EncodeTest {
41 static const char *encode(T t) {
46 template struct EncodeTest<int>;
47 template struct EncodeTest<double>;
48 template struct EncodeTest<wchar_t>;
50 // @() boxing expressions.
51 template <typename T> struct BoxingTest {
52 static id box(T value) {
53 return @(value); // expected-error {{illegal type 'int *' used in a boxed expression}} \
54 // expected-error {{illegal type 'long double' used in a boxed expression}}
59 + (NSNumber *)numberWithInt:(int)value;
63 + (id)stringWithUTF8String:(const char *)str;
66 template struct BoxingTest<int>;
67 template struct BoxingTest<const char *>;
68 template struct BoxingTest<int *>; // expected-note {{in instantiation of member function 'BoxingTest<int *>::box' requested here}}
69 template struct BoxingTest<long double>; // expected-note {{in instantiation of member function 'BoxingTest<long double>::box' requested here}}