diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-12-29 12:47:11 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-12-29 12:47:11 +0200 |
| commit | e0b6140009eb3e2e53b8c90fe3973d80991bd9b8 (patch) | |
| tree | 0914af9cead7fabc104382bba2eb467cf5a2b702 /src/type.zig | |
| parent | 8a6295fcba80be9a145d59b103b6ec8d19636b38 (diff) | |
| download | zig-e0b6140009eb3e2e53b8c90fe3973d80991bd9b8.tar.gz zig-e0b6140009eb3e2e53b8c90fe3973d80991bd9b8.zip | |
Type: fix printing of default alignment on non-byte aligned pointers
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/type.zig b/src/type.zig index 43a3636ba3..632be95438 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2195,7 +2195,12 @@ pub const Type = extern union { .Slice => try writer.writeAll("[]"), } if (info.@"align" != 0 or info.host_size != 0 or info.vector_index != .none) { - try writer.print("align({d}", .{info.@"align"}); + if (info.@"align" != 0) { + try writer.print("align({d}", .{info.@"align"}); + } else { + const alignment = info.pointee_type.abiAlignment(mod.getTarget()); + try writer.print("align({d}", .{alignment}); + } if (info.bit_offset != 0 or info.host_size != 0) { try writer.print(":{d}:{d}", .{ info.bit_offset, info.host_size }); |
