2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-06-08 02:45:35 +08:00
|
|
|
|
2009-06-08 03:51:47 +08:00
|
|
|
// Obj-C string literal expressions
|
|
|
|
template <typename T> struct StringTest {
|
|
|
|
void f() {
|
|
|
|
(void)@"Hello";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template struct StringTest<int>;
|
|
|
|
template struct StringTest<double>;
|
|
|
|
|
|
|
|
// @selector expressions
|
|
|
|
template <typename T> struct SelectorTest {
|
|
|
|
SEL f() {
|
|
|
|
return @selector(multiple:arguments:);
|
|
|
|
}
|
|
|
|
SEL f2() {
|
|
|
|
return @selector(multiple:arguments:);
|
|
|
|
}
|
|
|
|
};
|
2009-06-08 02:45:35 +08:00
|
|
|
|
2009-06-08 03:51:47 +08:00
|
|
|
template struct SelectorTest<int>;
|
|
|
|
template struct SelectorTest<double>;
|
|
|
|
|
|
|
|
// @protocol expressions
|
|
|
|
@protocol P
|
|
|
|
@end
|
|
|
|
|
|
|
|
template <typename T> struct ProtocolTest {
|
|
|
|
void f() {
|
|
|
|
(void)@protocol(P);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template struct ProtocolTest<int>;
|
|
|
|
template struct ProtocolTest<double>;
|
|
|
|
|
|
|
|
// @encode expressions
|
|
|
|
template <typename T> struct EncodeTest {
|
2009-06-08 02:45:35 +08:00
|
|
|
static const char *encode(T t) {
|
|
|
|
return @encode(T);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-06-08 03:51:47 +08:00
|
|
|
template struct EncodeTest<int>;
|
|
|
|
template struct EncodeTest<double>;
|
2010-06-11 18:11:05 +08:00
|
|
|
template struct EncodeTest<wchar_t>;
|