stage2: fix @sizeOf for structs with comptime fields

This commit is contained in:
Andrew Kelley
2022-05-04 18:45:59 -07:00
parent 2f6a01d0c3
commit af7e945a7d
4 changed files with 15 additions and 1 deletions

View File

@@ -5177,7 +5177,7 @@ pub const Type = extern union {
const field = it.struct_obj.fields.values()[it.field];
defer it.field += 1;
if (!field.ty.hasRuntimeBits())
if (!field.ty.hasRuntimeBits() or field.is_comptime)
return FieldOffset{ .field = it.field, .offset = it.offset };
const field_align = field.normalAlignment(it.target);