std: align some function pointers
This commit is contained in:
@@ -2124,11 +2124,11 @@ test "pointer" {
|
||||
try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value});
|
||||
}
|
||||
{
|
||||
const value = @intToPtr(*const fn () void, 0xdeadbeef);
|
||||
const value = @intToPtr(*align(1) const fn () void, 0xdeadbeef);
|
||||
try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});
|
||||
}
|
||||
{
|
||||
const value = @intToPtr(*const fn () void, 0xdeadbeef);
|
||||
const value = @intToPtr(*align(1) const fn () void, 0xdeadbeef);
|
||||
try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ test "cast" {
|
||||
const FnPtr = if (@import("builtin").zig_backend == .stage1)
|
||||
?fn (*anyopaque) void
|
||||
else
|
||||
?*const fn (*anyopaque) void;
|
||||
?*align(1) const fn (*anyopaque) void;
|
||||
try testing.expect(cast(FnPtr, 0) == @intToPtr(FnPtr, @as(usize, 0)));
|
||||
try testing.expect(cast(FnPtr, foo) == @intToPtr(FnPtr, @bitCast(usize, @as(isize, -1))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user