From a479fd313248a55273a17de5f9af6b82abdb0be4 Mon Sep 17 00:00:00 2001 From: SuperAuguste <19855629+SuperAuguste@users.noreply.github.com> Date: Sun, 10 Dec 2023 05:10:58 -0500 Subject: Fix some comptime packed struct issues Co-authored-by: Veikka Tuominen --- src/type.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/type.zig') diff --git a/src/type.zig b/src/type.zig index 64a85aaa2d..067deecfea 100644 --- a/src/type.zig +++ b/src/type.zig @@ -1607,8 +1607,12 @@ pub const Type = struct { .type_info => unreachable, }, .struct_type => |struct_type| { - if (struct_type.layout == .Packed) { - if (opt_sema) |sema| try sema.resolveTypeLayout(ty); + const is_packed = struct_type.layout == .Packed; + if (opt_sema) |sema| { + try sema.resolveTypeFields(ty); + if (is_packed) try sema.resolveTypeLayout(ty); + } + if (is_packed) { return try Type.fromInterned(struct_type.backingIntType(ip).*).bitSizeAdvanced(mod, opt_sema); } return (try ty.abiSizeAdvanced(mod, strat)).scalar * 8; -- cgit v1.2.3