diff --git a/test/behavior/bugs/6305.zig b/test/behavior/bugs/6305.zig new file mode 100644 index 0000000000..6912944ad1 --- /dev/null +++ b/test/behavior/bugs/6305.zig @@ -0,0 +1,10 @@ +const ListNode = struct { + next: ?*const @This() = null, +}; + +test "copy array of self-referential struct" { + comptime var nodes = [_]ListNode{ .{}, .{} }; + nodes[0].next = &nodes[1]; + const copy = nodes; + _ = copy; +}