source:
tests/errors/completeType.cfa
@
21baa40
Last change on this file since 21baa40 was 686cb63, checked in by , 5 years ago | |
---|---|
|
|
File size: 709 bytes |
Rev | Line | |
---|---|---|
[2c57025] | 1 | void foo(int *) {} |
2 | void bar(void *) {} | |
3 | forall(otype T) void baz(T *); | |
4 | forall(dtype T) void qux(T *); | |
5 | forall(dtype T | sized(T)) void quux(T *); | |
6 | ||
[f29d603] | 7 | struct A; // incomplete |
8 | struct B {}; // complete | |
[f7e749f] | 9 | |
[2c57025] | 10 | int main() { |
[f29d603] | 11 | int * i; |
12 | void * v; | |
[2c57025] | 13 | |
[4d5e57b] | 14 | A * x; |
15 | A * y; | |
16 | B * x; | |
17 | B * z; | |
[f7e749f] | 18 | |
[2c57025] | 19 | // okay |
[0f35657] | 20 | *i; |
[7889f14] | 21 | *y; |
[4d5e57b] | 22 | *z; |
[2c57025] | 23 | foo(i); |
24 | bar(i); | |
25 | baz(i); | |
26 | qux(i); | |
27 | quux(i); | |
28 | ||
29 | bar(v); | |
30 | qux(v); | |
31 | ||
32 | // bad | |
[0f35657] | 33 | *v; |
[f29d603] | 34 | *x; // ambiguous |
[4d5e57b] | 35 | foo(v); |
[2c57025] | 36 | baz(v); |
37 | quux(v); | |
38 | } | |
39 | ||
[f7e749f] | 40 | |
[2c57025] | 41 | forall(otype T) |
42 | void baz(T * x) { | |
43 | // okay | |
44 | bar(x); | |
45 | baz(x); | |
46 | qux(x); | |
47 | quux(x); | |
[0f35657] | 48 | *x; |
[2c57025] | 49 | } |
50 | ||
51 | forall(dtype T) | |
52 | void qux(T * y) { | |
53 | // okay | |
[f29d603] | 54 | *y; |
[2c57025] | 55 | bar(y); |
56 | qux(y); | |
57 | ||
58 | // bad | |
59 | baz(y); | |
60 | quux(y); | |
61 | } | |
62 | ||
63 | forall(dtype T | sized(T)) | |
[142cf5d] | 64 | void quux(T * z) { |
[2c57025] | 65 | // okay |
66 | bar(z); | |
67 | qux(z); | |
68 | quux(z); | |
[0f35657] | 69 | *z; |
[2c57025] | 70 | |
71 | // bad | |
72 | baz(z); | |
73 | } |
Note: See TracBrowser
for help on using the repository browser.