mirror of
https://github.com/ziglang/zig.git
synced 2025-12-12 17:23:09 +00:00
fix behavior test which was relying on UB
This commit is contained in:
parent
2ee864ca5e
commit
388520a40b
@ -35,7 +35,8 @@ pub fn a(
|
|||||||
_ = flag_a;
|
_ = flag_a;
|
||||||
// With this bug present, `flag_b` would actually contain the value 17.
|
// With this bug present, `flag_b` would actually contain the value 17.
|
||||||
// Note: this bug only presents itself on debug mode.
|
// Note: this bug only presents itself on debug mode.
|
||||||
try std.testing.expect(@ptrCast(*const u8, &flag_b).* == 1);
|
const flag_b_byte: u8 = @boolToInt(flag_b);
|
||||||
|
try std.testing.expect(flag_b_byte == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn b(x: *X) !void {
|
pub fn b(x: *X) !void {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user