ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
Last change
on this file since a8615fd1 was 70529dc, checked in by Rob Schluntz <rschlunt@…>, 8 years ago |
Add typedefRedef test
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | typedef volatile struct Foo FooInterm;
|
---|
2 | typedef const FooInterm Foo;
|
---|
3 | #ifdef ERR1
|
---|
4 | typedef struct Foo Foo;
|
---|
5 | #endif
|
---|
6 |
|
---|
7 | typedef int ** pt;
|
---|
8 | typedef int ** pt;
|
---|
9 |
|
---|
10 | #ifdef __CFA__
|
---|
11 | extern "C" {
|
---|
12 | #endif
|
---|
13 | typedef int __io_read_fn ( char buf);
|
---|
14 | typedef 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 |
|
---|
23 | int sz;
|
---|
24 | typedef int FUNC(int, ...);
|
---|
25 | typedef int FUNC(int, ...);
|
---|
26 |
|
---|
27 | typedef int ARR[];
|
---|
28 | typedef int ARR[];
|
---|
29 | // #ifdef ERR1
|
---|
30 | // if a typedef has an array dimension,
|
---|
31 | // it can only be redefined to the same dimension
|
---|
32 | typedef int ARR[2];
|
---|
33 | // #endif
|
---|
34 |
|
---|
35 | typedef int X;
|
---|
36 | typedef int Y;
|
---|
37 | typedef Y Y2;
|
---|
38 | typedef X X2;
|
---|
39 |
|
---|
40 | typedef Y2 Z;
|
---|
41 | typedef X2 Z;
|
---|
42 |
|
---|
43 | typedef Z X2;
|
---|
44 | typedef int X2;
|
---|
45 | typedef Z X2;
|
---|
46 | typedef 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 |
|
---|
55 | int 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.