source:
src/tests/completeTypeError.c
@
0f35657
Last change on this file since 0f35657 was 0f35657, checked in by , 8 years ago | |
---|---|
|
|
File size: 656 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 | ||
7 | int main() { | |
8 | int *i; | |
9 | void *v; | |
10 | ||
11 | // okay | |
[0f35657] | 12 | *i; |
[2c57025] | 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 | |
[0f35657] | 24 | *v; |
[2c57025] | 25 | baz(v); |
26 | quux(v); | |
27 | } | |
28 | ||
29 | forall(otype T) | |
30 | void baz(T * x) { | |
31 | // okay | |
32 | bar(x); | |
33 | baz(x); | |
34 | qux(x); | |
35 | quux(x); | |
[0f35657] | 36 | *x; |
[2c57025] | 37 | } |
38 | ||
39 | forall(dtype T) | |
40 | void qux(T * y) { | |
41 | // okay | |
42 | bar(y); | |
43 | qux(y); | |
44 | ||
45 | // bad | |
46 | baz(y); | |
47 | quux(y); | |
[0f35657] | 48 | *y; |
[2c57025] | 49 | } |
50 | ||
51 | forall(dtype T | sized(T)) | |
52 | void qux(T * z) { | |
53 | // okay | |
54 | bar(z); | |
55 | qux(z); | |
56 | quux(z); | |
[0f35657] | 57 | *z; |
[2c57025] | 58 | |
59 | // bad | |
60 | baz(z); | |
61 | } | |
62 |
Note: See TracBrowser
for help on using the repository browser.