| author | |
| committer | |
| log | 3c046ab9d94c96632bdfd21ad20bea0613bfc1e2 |
| tree | b698f2895f89b8be64d7ac40db641dffca7862b9 |
| parent | c41ac8f19ec96ed854d9ac31a2015006ba3e4657 |
https://github.com/ziglang/zig/issues/96281 files changed, 7 insertions(+), 0 deletions(-)
doc/langref/test_coerce_slices_arrays_and_pointers.zig+7| ... | ... | @@ -67,4 +67,11 @@ test "*T to *[1]T" { |
| 67 | 67 | try expect(z[0] == 1234); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | // Sentinel-terminated slices can be coerced into sentinel-terminated pointers | |
| 71 | test "[:x]T to [*:x]T" { | |
| 72 | const buf: [:0]const u8 = "hello"; | |
| 73 | const buf2: [*:0]const u8 = buf; | |
| 74 | try expect(buf2[4] == 'o'); | |
| 75 | } | |
| 76 | ||
| 70 | 77 | // test |