ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since 2c57025 was
2c57025,
checked in by Rob Schluntz <rschlunt@…>, 8 years ago
|
add support for built-in sized trait which decouples size/alignment information from otype parameters, add test for sized trait
|
-
Property mode set to
100644
|
File size:
631 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 |
---|
| 12 | foo(i); |
---|
| 13 | bar(i); |
---|
| 14 | baz(i); |
---|
| 15 | qux(i); |
---|
| 16 | quux(i); |
---|
| 17 | |
---|
| 18 | bar(v); |
---|
| 19 | qux(v); |
---|
| 20 | foo(v); // questionable, but works at the moment for C compatibility |
---|
| 21 | |
---|
| 22 | // bad |
---|
| 23 | baz(v); |
---|
| 24 | quux(v); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | forall(otype T) |
---|
| 28 | void baz(T * x) { |
---|
| 29 | // okay |
---|
| 30 | bar(x); |
---|
| 31 | baz(x); |
---|
| 32 | qux(x); |
---|
| 33 | quux(x); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | forall(dtype T) |
---|
| 37 | void qux(T * y) { |
---|
| 38 | // okay |
---|
| 39 | bar(y); |
---|
| 40 | qux(y); |
---|
| 41 | |
---|
| 42 | // bad |
---|
| 43 | baz(y); |
---|
| 44 | quux(y); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | forall(dtype T | sized(T)) |
---|
| 48 | void qux(T * z) { |
---|
| 49 | // okay |
---|
| 50 | bar(z); |
---|
| 51 | qux(z); |
---|
| 52 | quux(z); |
---|
| 53 | |
---|
| 54 | // bad |
---|
| 55 | baz(z); |
---|
| 56 | } |
---|
| 57 | |
---|
Note: See
TracBrowser
for help on using the repository browser.