aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/encode-9.mm
blob: 4fdb5fa50fb777b4c71a3f0a5e59651ca4a9ef90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* Test than @encode is properly instantiated. */
/* { dg-do run } */

#include <string.h>           
#include <stdlib.h>
#include <objc/objc.h>

template<typename T>
class typeOf {
public:
    operator const char*() { return @encode(T); }
};

int main() {
    typeOf<int> t;
    if (strcmp ((const char *)t, @encode(int)))
      abort();

    typeOf<const char*> c;
    if (strcmp ((const char *)c, @encode(const char*)))
      abort();

    return 0;
}