diff options
Diffstat (limited to 'tests/conformance/3-expressions/ptr_addr_of_forms.zc')
| -rw-r--r-- | tests/conformance/3-expressions/ptr_addr_of_forms.zc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/conformance/3-expressions/ptr_addr_of_forms.zc b/tests/conformance/3-expressions/ptr_addr_of_forms.zc new file mode 100644 index 0000000..4bcf8cf --- /dev/null +++ b/tests/conformance/3-expressions/ptr_addr_of_forms.zc @@ -0,0 +1,24 @@ +// expect: 1/1/1/1/ +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +struct pt { int x; int y; } +int gv; +fn main() { + int a = 3; + int* pa = &a; + *pa = 4; + pn(a == 4); + *(&gv) = 8; + pn(gv == 8); + pt* q = rt.new(pt); + int* py = &q.y; + *py = 6; + pn(q.y == 6); + int[3] arr; + int* pe = &arr[2]; + *pe = 1; + pn(arr[2]); + rt.free(q); + return 0; +} +// zc0: skip |
