Fariborz Jahanian | 01ed063 | 2009-12-14 18:00:56 +0000 | [diff] [blame] | 1 | // RUN: clang -cc1 -fsyntax-only -verify %s |
Anders Carlsson | fc0f021 | 2009-06-07 18:45:35 +0000 | [diff] [blame] | 2 | |
Anders Carlsson | 02d95ba | 2009-06-07 19:51:47 +0000 | [diff] [blame] | 3 | // Obj-C string literal expressions |
| 4 | template <typename T> struct StringTest { |
| 5 | void f() { |
| 6 | (void)@"Hello"; |
| 7 | } |
| 8 | }; |
Anders Carlsson | fc0f021 | 2009-06-07 18:45:35 +0000 | [diff] [blame] | 9 | |
Anders Carlsson | 02d95ba | 2009-06-07 19:51:47 +0000 | [diff] [blame] | 10 | template struct StringTest<int>; |
| 11 | template struct StringTest<double>; |
| 12 | |
| 13 | // @selector expressions |
| 14 | template <typename T> struct SelectorTest { |
| 15 | SEL f() { |
| 16 | return @selector(multiple:arguments:); |
| 17 | } |
| 18 | SEL f2() { |
| 19 | return @selector(multiple:arguments:); |
| 20 | } |
| 21 | }; |
| 22 | |
| 23 | template struct SelectorTest<int>; |
| 24 | template struct SelectorTest<double>; |
| 25 | |
| 26 | // @protocol expressions |
| 27 | @protocol P |
| 28 | @end |
| 29 | |
| 30 | template <typename T> struct ProtocolTest { |
| 31 | void f() { |
| 32 | (void)@protocol(P); |
| 33 | } |
| 34 | }; |
| 35 | |
| 36 | template struct ProtocolTest<int>; |
| 37 | template struct ProtocolTest<double>; |
| 38 | |
| 39 | // @encode expressions |
| 40 | template <typename T> struct EncodeTest { |
Anders Carlsson | fc0f021 | 2009-06-07 18:45:35 +0000 | [diff] [blame] | 41 | static const char *encode(T t) { |
| 42 | return @encode(T); |
| 43 | } |
| 44 | }; |
| 45 | |
Anders Carlsson | 02d95ba | 2009-06-07 19:51:47 +0000 | [diff] [blame] | 46 | template struct EncodeTest<int>; |
| 47 | template struct EncodeTest<double>; |