#Packed struct backing integer type too big
1 messages · Page 1 of 1 (latest)
whats in the struct?
In my actual project it contains some enums, but I was able to reproduce the same error with this code:
const Foo = packed struct(u8) {
a: u4,
b: u3,
};
pub fn main() !void {
const foo: Foo = undefined;
_ = foo;
}
you have to be specific about where the 1 bit of padding is, add something like _padding: u1 = undefined
Thanks, this one works:
const Foo = packed struct(u8) {
a: u4,
b: u3,
_: u1 = undefined,
};
pub fn main() !void {
const foo: Foo = undefined;
_ = foo;
}