summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/encode-9.mm
blob: 6b064dfdc09d1ea6aef94bc55776890ce30e7cbe (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
26
/* Test than @encode is properly instantiated. */
/* { dg-options "-lobjc" } */
/* { 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;
}