Sema: add missing calls to wip_captures.finalize

Closes #13171
This commit is contained in:
Veikka Tuominen 2022-10-18 19:11:54 +03:00
parent 3b60a6de2f
commit 9a52abf3b4
3 changed files with 19 additions and 0 deletions

View File

@ -28775,6 +28775,7 @@ fn semaBackingIntType(mod: *Module, struct_obj: *Module.Struct) CompileError!voi
try sema.checkBackingIntType(&block, backing_int_src, backing_int_ty, fields_bit_sum); try sema.checkBackingIntType(&block, backing_int_src, backing_int_ty, fields_bit_sum);
struct_obj.backing_int_ty = try backing_int_ty.copy(decl_arena_allocator); struct_obj.backing_int_ty = try backing_int_ty.copy(decl_arena_allocator);
try wip_captures.finalize();
} else { } else {
var buf: Type.Payload.Bits = .{ var buf: Type.Payload.Bits = .{
.base = .{ .tag = .int_unsigned }, .base = .{ .tag = .int_unsigned },
@ -29386,6 +29387,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void
} }
} }
} }
try wip_captures.finalize();
struct_obj.have_field_inits = true; struct_obj.have_field_inits = true;
} }

View File

@ -108,6 +108,7 @@ test {
_ = @import("behavior/bugs/13112.zig"); _ = @import("behavior/bugs/13112.zig");
_ = @import("behavior/bugs/13128.zig"); _ = @import("behavior/bugs/13128.zig");
_ = @import("behavior/bugs/13164.zig"); _ = @import("behavior/bugs/13164.zig");
_ = @import("behavior/bugs/13171.zig");
_ = @import("behavior/byteswap.zig"); _ = @import("behavior/byteswap.zig");
_ = @import("behavior/byval_arg_var.zig"); _ = @import("behavior/byval_arg_var.zig");
_ = @import("behavior/call.zig"); _ = @import("behavior/call.zig");

View File

@ -0,0 +1,16 @@
const std = @import("std");
const expect = std.testing.expect;
fn BuildType(comptime T: type) type {
return struct {
val: union {
b: T,
},
};
}
test {
const TestStruct = BuildType(u32);
const c = TestStruct{ .val = .{ .b = 10 } };
try expect(c.val.b == 10);
}