OSDN Git Service

In gcc/objc/:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / obj-c++.dg / encode-9.mm
1 /* Test than @encode is properly instantiated. */
2 /* { dg-options "-lobjc" } */
3 /* { dg-do run } */
4
5 #include <string.h>           
6 #include <stdlib.h>
7 #include <objc/objc.h>
8
9 template<typename T>
10 class typeOf {
11 public:
12     operator const char*() { return @encode(T); }
13 };
14
15 int main() {
16     typeOf<int> t;
17     if (strcmp ((const char *)t, @encode(int)))
18       abort();
19
20     typeOf<const char*> c;
21     if (strcmp ((const char *)c, @encode(const char*)))
22       abort();
23
24     return 0;
25 }
26