OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [encode-10.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Test for @encode in templates.  */
2
/* { dg-options "-lobjc" } */
3
/* { dg-do run } */
4
#include 
5
#include 
6
 
7
template
8
const 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
 
31
int main()
32
{
33
  if (strcmp (@encode(char), my_encode(0)))
34
    abort ();
35
 
36
  if (strcmp (@encode(char *), my_encode(1)))
37
    abort ();
38
 
39
  if (strcmp (@encode(const char *), my_encode(2)))
40
    abort ();
41
 
42
  if (strcmp (@encode(int), my_encode(3)))
43
    abort ();
44
 
45
  return 0;
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.