The value of comptime fields can’t be modified (in compile time). And they don’t contribute to type sizes.
Is there any real usefulness of comptime fields?
const std = @import("std");
const T = struct {
comptime n: u32 = 0,
// <=>
// const n: u32 = 0;
};
pub fn main() void {
comptime var t: T = .{};
//t.n = 1; // error: value stored in comptime field does not match the default value of the field
t = t;
std.debug.print("{}\n", .{@sizeOf(T)}); // 0
}