authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-18 19:11:54+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-20 20:11:12+03:00
log9a52abf3b47447b4ce976a99daca1c9c859c5aca
tree3edb1bbc987575ec18ee68a6c54f67b9c92a001d
parent3b60a6de2fd68d7d02de7a10b8b88c919aa088f0

Sema: add missing calls to `wip_captures.finalize`

Closes #13171

3 files changed, 19 insertions(+), 0 deletions(-)

src/Sema.zig+2
......@@ -28775,6 +28775,7 @@ fn semaBackingIntType(mod: *Module, struct_obj: *Module.Struct) CompileError!voi
2877528775
2877628776 try sema.checkBackingIntType(&block, backing_int_src, backing_int_ty, fields_bit_sum);
2877728777 struct_obj.backing_int_ty = try backing_int_ty.copy(decl_arena_allocator);
28778 try wip_captures.finalize();
2877828779 } else {
2877928780 var buf: Type.Payload.Bits = .{
2878028781 .base = .{ .tag = .int_unsigned },
......@@ -29386,6 +29387,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void
2938629387 }
2938729388 }
2938829389 }
29390 try wip_captures.finalize();
2938929391
2939029392 struct_obj.have_field_inits = true;
2939129393}
test/behavior.zig+1
......@@ -108,6 +108,7 @@ test {
108108 _ = @import("behavior/bugs/13112.zig");
109109 _ = @import("behavior/bugs/13128.zig");
110110 _ = @import("behavior/bugs/13164.zig");
111 _ = @import("behavior/bugs/13171.zig");
111112 _ = @import("behavior/byteswap.zig");
112113 _ = @import("behavior/byval_arg_var.zig");
113114 _ = @import("behavior/call.zig");
test/behavior/bugs/13171.zig created+16
......@@ -0,0 +1,16 @@
1const std = @import("std");
2const expect = std.testing.expect;
3
4fn BuildType(comptime T: type) type {
5 return struct {
6 val: union {
7 b: T,
8 },
9 };
10}
11
12test {
13 const TestStruct = BuildType(u32);
14 const c = TestStruct{ .val = .{ .b = 10 } };
15 try expect(c.val.b == 10);
16}