Commit de24cea2cf
Changed files (3)
src
test
behavior
bugs
src/Sema.zig
@@ -24770,6 +24770,20 @@ fn beginComptimePtrMutation(
else => unreachable,
},
+ .empty_struct_value => {
+ const duped = try sema.arena.create(Value);
+ duped.* = Value.initTag(.the_only_possible_value);
+ return beginComptimePtrMutationInner(
+ sema,
+ block,
+ src,
+ parent.ty.structFieldType(field_index),
+ duped,
+ ptr_elem_ty,
+ parent.decl_ref_mut,
+ );
+ },
+
else => unreachable,
},
.reinterpret => |reinterpret| {
test/behavior/bugs/12794.zig
@@ -0,0 +1,38 @@
+const std = @import("std");
+
+fn NamespacedComponents(comptime modules: anytype) type {
+ return @Type(.{
+ .Struct = .{
+ .layout = .Auto,
+ .is_tuple = false,
+ .fields = &.{.{
+ .name = "components",
+ .field_type = @TypeOf(modules.components),
+ .default_value = null,
+ .is_comptime = false,
+ .alignment = @alignOf(@TypeOf(modules.components)),
+ }},
+ .decls = &[_]std.builtin.Type.Declaration{},
+ },
+ });
+}
+
+fn namespacedComponents(comptime modules: anytype) NamespacedComponents(modules) {
+ var x: NamespacedComponents(modules) = undefined;
+ x.components = modules.components;
+ return x;
+}
+
+pub fn World(comptime modules: anytype) type {
+ const all_components = namespacedComponents(modules);
+ _ = all_components;
+ return struct {};
+}
+
+test {
+ _ = World(.{
+ .components = .{
+ .location = 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/12794.zig");
_ = @import("behavior/byteswap.zig");
_ = @import("behavior/byval_arg_var.zig");
_ = @import("behavior/call.zig");