Add behavior test for copying self-referential struct
Closes #6312. In the C++ implementation this caused a stack overflow from infinite recursion during analysis.
This commit is contained in:
10
test/behavior/bugs/6305.zig
Normal file
10
test/behavior/bugs/6305.zig
Normal file
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user