zig/test/behavior/bugs/6305.zig
Stevie Hryciw 2ad6ca581d Add behavior test for copying self-referential struct
Closes #6312. In the C++ implementation this caused a stack overflow
from infinite recursion during analysis.
2023-08-06 18:23:28 -07:00

11 lines
232 B
Zig

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;
}