Commit 930f904aaa
Changed files (3)
src
test
behavior
bugs
src/Sema.zig
@@ -17406,7 +17406,7 @@ fn reifyStruct(
if (!try sema.intFitsInType(block, src, alignment_val, Type.u32, null)) {
return sema.fail(block, src, "alignment must fit in 'u32'", .{});
}
- const abi_align = @intCast(u29, alignment_val.toUnsignedInt(target));
+ const abi_align = @intCast(u29, (try alignment_val.getUnsignedIntAdvanced(target, sema.kit(block, src))).?);
const field_name = try name_val.toAllocatedBytes(
Type.initTag(.const_slice_u8),
test/behavior/bugs/12786.zig
@@ -0,0 +1,28 @@
+const std = @import("std");
+
+fn NamespacedGlobals(comptime modules: anytype) type {
+ return @Type(.{
+ .Struct = .{
+ .layout = .Auto,
+ .is_tuple = false,
+ .fields = &.{
+ .{
+ .name = "globals",
+ .field_type = modules.mach.globals,
+ .default_value = null,
+ .is_comptime = false,
+ .alignment = @alignOf(modules.mach.globals),
+ },
+ },
+ .decls = &[_]std.builtin.Type.Declaration{},
+ },
+ });
+}
+
+test {
+ _ = NamespacedGlobals(.{
+ .mach = .{
+ .globals = struct {},
+ },
+ });
+}
test/behavior.zig
@@ -87,6 +87,7 @@ test {
_ = @import("behavior/bugs/12486.zig");
_ = @import("behavior/bugs/12680.zig");
_ = @import("behavior/bugs/12776.zig");
+ _ = @import("behavior/bugs/12786.zig");
_ = @import("behavior/bugs/12794.zig");
_ = @import("behavior/byteswap.zig");
_ = @import("behavior/byval_arg_var.zig");