source: src/tests/completeTypeError.c@ 0f35657

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 new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new stuck-waitfor-destruct with_gc
Last change on this file since 0f35657 was 0f35657, checked in by Rob Schluntz <rschlunt@…>, 9 years ago

updated completeTypeError test case

  • Property mode set to 100644
File size: 656 bytes
Line 
1void foo(int *) {}
2void bar(void *) {}
3forall(otype T) void baz(T *);
4forall(dtype T) void qux(T *);
5forall(dtype T | sized(T)) void quux(T *);
6
7int main() {
8 int *i;
9 void *v;
10
11 // okay
12 *i;
13 foo(i);
14 bar(i);
15 baz(i);
16 qux(i);
17 quux(i);
18
19 bar(v);
20 qux(v);
21 foo(v); // questionable, but works at the moment for C compatibility
22
23 // bad
24 *v;
25 baz(v);
26 quux(v);
27}
28
29forall(otype T)
30void baz(T * x) {
31 // okay
32 bar(x);
33 baz(x);
34 qux(x);
35 quux(x);
36 *x;
37}
38
39forall(dtype T)
40void qux(T * y) {
41 // okay
42 bar(y);
43 qux(y);
44
45 // bad
46 baz(y);
47 quux(y);
48 *y;
49}
50
51forall(dtype T | sized(T))
52void qux(T * z) {
53 // okay
54 bar(z);
55 qux(z);
56 quux(z);
57 *z;
58
59 // bad
60 baz(z);
61}
62
Note: See TracBrowser for help on using the repository browser.