source: tests/typedefRedef.cfa @ 3dcd11ba

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 3dcd11ba was 53692b3, checked in by Peter A. Buhr <pabuhr@…>, 3 years ago

second attempt to fix compile-only pragma message that gcc-10/11 quote

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[70529dc]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[];
[66812dd]29#ifdef ERR1
30// if a typedef has an array dimension, it can only be redefined to the same dimension
[70529dc]31typedef int ARR[2];
[66812dd]32#endif
[70529dc]33
34typedef int X;
35typedef int Y;
36typedef Y Y2;
37typedef X X2;
38
39typedef Y2 Z;
40typedef X2 Z;
41
42typedef Z X2;
43typedef int X2;
44typedef Z X2;
45typedef int X2;
46
47// xxx - this doesn't work yet due to parsing problems with generic types
48// #ifdef __CFA__
49// typedef forall(type T) void foo(T);
50// typedef forall(type T) void foo(T);
51// typedef forall(type S) void foo(S); // should be allowed to do this...
52// #endif
53
54int main() {
[66812dd]55        typedef int ARR[sz];
[70529dc]56
[66812dd]57        // can't redefine typedef which is VLA
[70529dc]58#if ERR1
[66812dd]59        typedef int ARR[sz];
[70529dc]60#endif
61
[66812dd]62        Foo * x;
63
64        typedef struct Bar Foo;
65        Foo * y;
[70529dc]66
[66812dd]67        typedef int *** pt;
[70529dc]68
[53692b3]69    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
[70529dc]70}
Note: See TracBrowser for help on using the repository browser.