zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 9965d960b594dcdc67b356201eba57db38be24f5 (tree)
parent d3f3de73ba181c96008e7e98832764b23e637875
Author: mlugg <mlugg@mlugg.co.uk>
Date:   Thu, 21 Sep 2023 21:36:31 +0100

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.

Diffstat:
Msrc/type.zig | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/type.zig b/src/type.zig @@ -1051,9 +1051,7 @@ pub const Type = struct { if (union_obj.hasTag(ip)) { return abiAlignmentAdvanced(union_obj.enum_tag_ty.toType(), mod, strat); } else { - return .{ - .scalar = Alignment.fromByteUnits(@intFromBool(union_obj.flagsPtr(ip).layout == .Extern)), - }; + return .{ .scalar = .@"1" }; } }