blob: 2780f8e5797835382df767f0d52b32a9265ff969 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Anders Carlssonfc0f0212009-06-07 18:45:35 +00002
Anders Carlsson02d95ba2009-06-07 19:51:47 +00003// Obj-C string literal expressions
4template <typename T> struct StringTest {
5 void f() {
6 (void)@"Hello";
7 }
8};
Anders Carlssonfc0f0212009-06-07 18:45:35 +00009
Anders Carlsson02d95ba2009-06-07 19:51:47 +000010template struct StringTest<int>;
11template struct StringTest<double>;
12
13// @selector expressions
14template <typename T> struct SelectorTest {
15 SEL f() {
16 return @selector(multiple:arguments:);
17 }
18 SEL f2() {
19 return @selector(multiple:arguments:);
20 }
21};
22
23template struct SelectorTest<int>;
24template struct SelectorTest<double>;
25
26// @protocol expressions
27@protocol P
28@end
29
30template <typename T> struct ProtocolTest {
31 void f() {
32 (void)@protocol(P);
33 }
34};
35
36template struct ProtocolTest<int>;
37template struct ProtocolTest<double>;
38
39// @encode expressions
40template <typename T> struct EncodeTest {
Anders Carlssonfc0f0212009-06-07 18:45:35 +000041 static const char *encode(T t) {
42 return @encode(T);
43 }
44};
45
Anders Carlsson02d95ba2009-06-07 19:51:47 +000046template struct EncodeTest<int>;
47template struct EncodeTest<double>;
John McCall24da7092010-06-11 10:11:05 +000048template struct EncodeTest<wchar_t>;