std.debug.assertAligned: support const pointers

This commit is contained in:
Andrew Kelley 2025-09-07 20:22:38 -07:00 committed by Alex Rønne Petersen
parent cbe1b4571b
commit f06c3d8be7
No known key found for this signature in database

View File

@ -569,7 +569,7 @@ pub fn assertReadable(slice: []const volatile u8) void {
/// Invokes detectable illegal behavior when the provided array is not aligned
/// to the provided amount.
pub fn assertAligned(ptr: anytype, comptime alignment: std.mem.Alignment) void {
const aligned_ptr: *align(alignment.toByteUnits()) anyopaque = @ptrCast(@alignCast(ptr));
const aligned_ptr: *align(alignment.toByteUnits()) const anyopaque = @ptrCast(@alignCast(ptr));
_ = aligned_ptr;
}