1/* Test for @encode in templates.  */
2/* { dg-options "-lobjc" } */
3/* { dg-do run } */
4#include <string.h>
5#include <stdlib.h>
6
7template<typename T>
8const char *my_encode(int variant)
9{
10  const char *result;
11
12  switch (variant)
13    {
14    case 0:
15      result = @encode(T);
16      break;
17    case 1:
18      result = @encode(T*);
19      break;
20    case 2:
21      result = @encode(const T*);
22      break;
23    default:
24      result = @encode(int);
25      break;
26    }
27
28  return result;
29}
30
31int main()
32{
33  if (strcmp (@encode(char), my_encode<char>(0)))
34    abort ();
35
36  if (strcmp (@encode(char *), my_encode<char>(1)))
37    abort ();
38
39  if (strcmp (@encode(const char *), my_encode<char>(2)))
40    abort ();
41
42  if (strcmp (@encode(int), my_encode<char>(3)))
43    abort ();
44
45  return 0;
46}
47