| ... | @@ -421,21 +421,10 @@ test "packed struct 24bits" { | ... | @@ -421,21 +421,10 @@ test "packed struct 24bits" { |
| 421 | if (builtin.cpu.arch == .arm) return error.SkipZigTest; // TODO | 421 | if (builtin.cpu.arch == .arm) return error.SkipZigTest; // TODO |
| 422 | | 422 | |
| 423 | comptime { | 423 | comptime { |
| 424 | // TODO Remove if and leave only the else branch when it is also fixed in stage2 | 424 | // stage1 gets the wrong answer for sizeof |
| 425 | if (builtin.zig_backend == .stage2_llvm or builtin.zig_backend == .stage2_x86 or | 425 | if (builtin.zig_backend != .stage1) { |
| 426 | builtin.zig_backend == .stage2_riscv64) | 426 | std.debug.assert(@sizeOf(Foo24Bits) == @sizeOf(u24)); |
| 427 | { | 427 | std.debug.assert(@sizeOf(Foo96Bits) == @sizeOf(u96)); |
| 428 | // Stage 2 still expects the wrong values | | |
| 429 | try expect(@sizeOf(Foo24Bits) == 4); | | |
| 430 | if (@sizeOf(usize) == 4) { | | |
| 431 | try expect(@sizeOf(Foo96Bits) == 12); | | |
| 432 | } else { | | |
| 433 | try expect(@sizeOf(Foo96Bits) == 16); | | |
| 434 | } | | |
| 435 | } else { | | |
| 436 | // Stage1 is now fixed and is expected to return right values | | |
| 437 | try expectEqual(@sizeOf(Foo24Bits), 3); | | |
| 438 | try expectEqual(@sizeOf(Foo96Bits), 12); | | |
| 439 | } | 428 | } |
| 440 | } | 429 | } |
| 441 | | 430 | |