authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2023-09-21 21:36:31+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-21 14:48:41-07:00
log9965d960b594dcdc67b356201eba57db38be24f5
tree08713babf97744ec7f8998bbb8e7fa41be5103f8
parentd3f3de73ba181c96008e7e98832764b23e637875

type: give empty unions 1-byte alignment

Zero-byte alignment is no longer valid for runtime types. I made most of these changes in an earlier commit, but missed this case.

1 files changed, 1 insertions(+), 3 deletions(-)

src/type.zig+1-3
...@@ -1051,9 +1051,7 @@ pub const Type = struct {...@@ -1051,9 +1051,7 @@ pub const Type = struct {
1051 if (union_obj.hasTag(ip)) {1051 if (union_obj.hasTag(ip)) {
1052 return abiAlignmentAdvanced(union_obj.enum_tag_ty.toType(), mod, strat);1052 return abiAlignmentAdvanced(union_obj.enum_tag_ty.toType(), mod, strat);
1053 } else {1053 } else {
1054 return .{1054 return .{ .scalar = .@"1" };
1055 .scalar = Alignment.fromByteUnits(@intFromBool(union_obj.flagsPtr(ip).layout == .Extern)),
1056 };
1057 }1055 }
1058 }1056 }
10591057