Sema: @memcpy convert src slice to many ptr

Closes #15838
This commit is contained in:
Veikka Tuominen
2023-05-24 13:14:16 +03:00
parent 16dbb960fc
commit b2a514b3d2
2 changed files with 6 additions and 1 deletions

View File

@@ -58,7 +58,8 @@ test "@memcpy dest many pointer" {
fn testMemcpyDestManyPtr() !void {
var str = "hello".*;
var buf: [5]u8 = undefined;
@memcpy(@ptrCast([*]u8, &buf), @ptrCast([*]const u8, &str)[0..5]);
var len: usize = 5;
@memcpy(@ptrCast([*]u8, &buf), @ptrCast([*]const u8, &str)[0..len]);
try expect(buf[0] == 'h');
try expect(buf[1] == 'e');
try expect(buf[2] == 'l');