aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/bugs/6850.zig
blob: 6dafd524c5b1fee737b115807882ca6d32c4b412 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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);
}