master
1const std = @import("std");
2
3test {
4 const dest = foo();
5 const source = foo();
6
7 @memcpy(dest, source);
8 @memmove(dest, source);
9 @memset(dest, 4);
10 @memset(dest, undefined);
11
12 const dest2 = foo2();
13 @memset(dest2, 0);
14}
15
16fn foo() []u8 {
17 const ptr = comptime std.mem.alignBackward(usize, std.math.maxInt(usize), 1);
18 return @as([*]align(1) u8, @ptrFromInt(ptr))[0..0];
19}
20
21fn foo2() []u64 {
22 const ptr = comptime std.mem.alignBackward(usize, std.math.maxInt(usize), 1);
23 return @as([*]align(1) u64, @ptrFromInt(ptr))[0..0];
24}