source: tests/typedefRedef.cfa @ 686cb63

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 686cb63 was dc8511c, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

first attempt at updating suffixes for test programs

  • Property mode set to 100644
File size: 1.1 KB
Line 
1typedef volatile struct Foo FooInterm;
2typedef const FooInterm Foo;
3#ifdef ERR1
4typedef struct Foo Foo;
5#endif
6
7typedef int ** pt;
8typedef int ** pt;
9
10#ifdef __CFA__
11extern "C" {
12#endif
13typedef int __io_read_fn ( char buf);
14typedef int __io_write_fn ( const char buf);
15
16
17__io_read_fn read;
18__io_write_fn write;
19#ifdef __CFA__
20}
21#endif
22
23int sz;
24typedef int FUNC(int, ...);
25typedef int FUNC(int, ...);
26
27typedef int ARR[];
28typedef int ARR[];
29// #ifdef ERR1
30// if a typedef has an array dimension,
31// it can only be redefined to the same dimension
32typedef int ARR[2];
33// #endif
34
35typedef int X;
36typedef int Y;
37typedef Y Y2;
38typedef X X2;
39
40typedef Y2 Z;
41typedef X2 Z;
42
43typedef Z X2;
44typedef int X2;
45typedef Z X2;
46typedef int X2;
47
48// xxx - this doesn't work yet due to parsing problems with generic types
49// #ifdef __CFA__
50// typedef forall(type T) void foo(T);
51// typedef forall(type T) void foo(T);
52// typedef forall(type S) void foo(S); // should be allowed to do this...
53// #endif
54
55int main() {
56  typedef int ARR[sz];
57
58  // can't redefine typedef which is VLA
59#if ERR1
60  typedef int ARR[sz];
61#endif
62
63  Foo *x;
64
65  typedef struct Bar Foo;
66  Foo *y;
67
68  typedef int *** pt;
69}
Note: See TracBrowser for help on using the repository browser.