Files
zig/test/cases/compile_errors/simple_struct_loop.zig
Matthew Lugg a3d2f2999f tests: add new tests
Some for bugs which have been fixed, some for language changes.
2026-03-10 11:28:36 +00:00

17 lines
376 B
Zig

const A = struct {
b: B,
};
const B = struct {
a: A,
};
comptime {
_ = @as(A, undefined);
}
// error
//
// error: dependency loop with length 2
// :2:8: note: type 'tmp.A' depends on type 'tmp.B' for field declared here
// :5:8: note: type 'tmp.B' depends on type 'tmp.A' for field declared here
// note: eliminate any one of these dependencies to break the loop