| author | |
| committer | |
| log | 5fe9f88b13f37e14fcb91e155e3e686eccb89dfc |
| tree | 1f53670faa2339589215047c9ffd6d39449c81e1 |
| parent | 6635360dbdbd6793b741648d51d25f12550e01db |
| parent | f776e70c3967da637d5488b6a8efaa8377680208 |
| signature |
Minor LLVM backend fixes2 files changed, 9 insertions(+), 1 deletions(-)
src/codegen/llvm.zig+2-1| ... | ... | @@ -3775,6 +3775,7 @@ pub const Object = struct { |
| 3775 | 3775 | .float, |
| 3776 | 3776 | .enum_tag, |
| 3777 | 3777 | => {}, |
| 3778 | .opt => {}, // pointer like optional expected | |
| 3778 | 3779 | else => unreachable, |
| 3779 | 3780 | } |
| 3780 | 3781 | const bits = ty.bitSize(mod); |
| ... | ... | @@ -4376,7 +4377,7 @@ pub const Object = struct { |
| 4376 | 4377 | .int => try o.builder.castConst( |
| 4377 | 4378 | .inttoptr, |
| 4378 | 4379 | try o.builder.intConst(try o.lowerType(Type.usize), offset), |
| 4379 | .ptr, | |
| 4380 | try o.lowerType(Type.fromInterned(ptr.ty)), | |
| 4380 | 4381 | ), |
| 4381 | 4382 | .eu_payload => |eu_ptr| try o.lowerPtr( |
| 4382 | 4383 | eu_ptr, |
test/behavior/packed-struct.zig+7| ... | ... | @@ -1304,3 +1304,10 @@ test "2-byte packed struct argument in C calling convention" { |
| 1304 | 1304 | try S.bar(s); |
| 1305 | 1305 | } |
| 1306 | 1306 | } |
| 1307 | ||
| 1308 | test "packed struct contains optional pointer" { | |
| 1309 | const foo: packed struct { | |
| 1310 | a: ?*@This() = null, | |
| 1311 | } = .{}; | |
| 1312 | try expect(foo.a == null); | |
| 1313 | } |