zig
zig copied to clipboard
std.fmt incorrectly displaying vector of bools
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
const std = @import("std");
test {
const ally = std.testing.allocator;
const a: [*]bool = (try ally.alloc(bool,6)).ptr;
defer ally.free(a[0..6]);
a[1..][0..5].* = .{ false, false, false, false, false };
const b: @Vector(5, bool) = a[0..][0..5].*;
std.log.warn("b: {}", .{b});
std.log.warn("b: {{ {}, {}, {}, {}, {} }}", .{b[0],b[1],b[2],b[3],b[4]});
return error.PrintsDoNotMatch;
}
Log output:
[default] (warn): b: { false, true, false, true, false }
[default] (warn): b: { false, false, false, false, false }
Expected Behavior
I would expect the 2 log entries to match
note: a[0] is undefined
yes, I would still expect the prints to match, though