mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
parent
3b60a6de2f
commit
9a52abf3b4
@ -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);
|
||||
struct_obj.backing_int_ty = try backing_int_ty.copy(decl_arena_allocator);
|
||||
try wip_captures.finalize();
|
||||
} else {
|
||||
var buf: Type.Payload.Bits = .{
|
||||
.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;
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ test {
|
||||
_ = @import("behavior/bugs/13112.zig");
|
||||
_ = @import("behavior/bugs/13128.zig");
|
||||
_ = @import("behavior/bugs/13164.zig");
|
||||
_ = @import("behavior/bugs/13171.zig");
|
||||
_ = @import("behavior/byteswap.zig");
|
||||
_ = @import("behavior/byval_arg_var.zig");
|
||||
_ = @import("behavior/call.zig");
|
||||
|
16
test/behavior/bugs/13171.zig
Normal file
16
test/behavior/bugs/13171.zig
Normal 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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user