mirror of
https://github.com/ziglang/zig.git
synced 2025-12-25 15:43:06 +00:00
13 lines
248 B
Zig
13 lines
248 B
Zig
const std = @import("std");
|
|
|
|
test "lazy sizeof comparison with zero" {
|
|
const Empty = struct {};
|
|
const T = *Empty;
|
|
|
|
try std.testing.expect(hasNoBits(T));
|
|
}
|
|
|
|
fn hasNoBits(comptime T: type) bool {
|
|
return @sizeOf(T) == @sizeOf(*i32);
|
|
}
|