| author | |
| committer | |
| log | e0b6140009eb3e2e53b8c90fe3973d80991bd9b8 |
| tree | 0914af9cead7fabc104382bba2eb467cf5a2b702 |
| parent | 8a6295fcba80be9a145d59b103b6ec8d19636b38 |
3 files changed, 8 insertions(+), 3 deletions(-)
src/type.zig+6-1| ... | ... | @@ -2195,7 +2195,12 @@ pub const Type = extern union { |
| 2195 | 2195 | .Slice => try writer.writeAll("[]"), |
| 2196 | 2196 | } |
| 2197 | 2197 | if (info.@"align" != 0 or info.host_size != 0 or info.vector_index != .none) { |
| 2198 | try writer.print("align({d}", .{info.@"align"}); | |
| 2198 | if (info.@"align" != 0) { | |
| 2199 | try writer.print("align({d}", .{info.@"align"}); | |
| 2200 | } else { | |
| 2201 | const alignment = info.pointee_type.abiAlignment(mod.getTarget()); | |
| 2202 | try writer.print("align({d}", .{alignment}); | |
| 2203 | } | |
| 2199 | 2204 | |
| 2200 | 2205 | if (info.bit_offset != 0 or info.host_size != 0) { |
| 2201 | 2206 | try writer.print(":{d}:{d}", .{ info.bit_offset, info.host_size }); |
test/cases/compile_errors/casting_bit_offset_pointer_to_regular_pointer.zig+1-1| ... | ... | @@ -18,7 +18,7 @@ export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } |
| 18 | 18 | // backend=stage2 |
| 19 | 19 | // target=native |
| 20 | 20 | // |
| 21 | // :8:16: error: expected type '*const u3', found '*align(0:3:1) const u3' | |
| 21 | // :8:16: error: expected type '*const u3', found '*align(1:3:1) const u3' | |
| 22 | 22 | // :8:16: note: pointer host size '1' cannot cast into pointer host size '0' |
| 23 | 23 | // :8:16: note: pointer bit offset '3' cannot cast into pointer bit offset '0' |
| 24 | 24 | // :11:11: note: parameter type declared here |
test/cases/compile_errors/incompatible sub-byte fields.zig	+1-1| ... | ... | @@ -24,4 +24,4 @@ export fn entry() void { |
| 24 | 24 | // backend=stage2 |
| 25 | 25 | // target=native |
| 26 | 26 | // |
| 27 | // :14:17: error: incompatible types: '*align(0:0:1) u2' and '*align(2:8:2) u2' | |
| 27 | // :14:17: error: incompatible types: '*align(1:0:1) u2' and '*align(2:8:2) u2' |