authorgravatar for codroid@gmail.comStevie Hryciw <codroid@gmail.com> 2023-08-06 18:23:28-07:00
committergravatar for codroid@gmail.comStevie Hryciw <codroid@gmail.com> 2023-08-06 18:23:28-07:00
log2ad6ca581da28a547b33d93f1a9855974a8b15c1
tree32199316e5f3c16a7047802fdac272271c79bdd0
parent16dcefaca5956af747c29d6ab1915cc955f81af9

Add behavior test for copying self-referential struct

Closes #6312. In the C++ implementation this caused a stack overflow from infinite recursion during analysis.

1 files changed, 10 insertions(+), 0 deletions(-)

test/behavior/bugs/6305.zig created+10
......@@ -0,0 +1,10 @@
1const ListNode = struct {
2 next: ?*const @This() = null,
3};
4
5test "copy array of self-referential struct" {
6 comptime var nodes = [_]ListNode{ .{}, .{} };
7 nodes[0].next = &nodes[1];
8 const copy = nodes;
9 _ = copy;
10}