diff options
| author | Raul Leal <raulgrell@gmail.com> | 2018-08-22 18:12:08 +0100 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-08-22 13:12:08 -0400 |
| commit | 87b10400c2a2d39f33e361cf4d7fd8caee7e519b (patch) | |
| tree | 318c5b472ebab1a255be891714c89567b943cdc9 /test/cases | |
| parent | 3d780cf2ef8391b6b48124f599858ee99ddc4cdc (diff) | |
| download | zig-87b10400c2a2d39f33e361cf4d7fd8caee7e519b.tar.gz zig-87b10400c2a2d39f33e361cf4d7fd8caee7e519b.zip | |
allow implicit cast from *[N]T to ?[*]T (#1398)
* allow implicit cast from *[N]T to ?[*]T
Diffstat (limited to 'test/cases')
| -rw-r--r-- | test/cases/cast.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cases/cast.zig b/test/cases/cast.zig index 63cc6313e1..df37bd1dd9 100644 --- a/test/cases/cast.zig +++ b/test/cases/cast.zig @@ -485,3 +485,14 @@ fn MakeType(comptime T: type) type { } }; } + +test "implicit cast from *[N]T to ?[*]T" { + var x: ?[*]u16 = null; + var y: [4]u16 = [4]u16 {0, 1, 2, 3}; + + x = &y; + assert(std.mem.eql(u16, x.?[0..4], y[0..4])); + x.?[0] = 8; + y[3] = 6; + assert(std.mem.eql(u16, x.?[0..4], y[0..4])); +}
\ No newline at end of file |
