Self referential comptime struct parameters

@finnamon Welcome to ziggit :slight_smile:

error: dependency loop detected
const Node = Wrap(usize, ?*Node);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

a workaround for this bug is to use:

const Node = Wrap(InnerType, ?*opaque {});

*opaque{} is a generic pointer, you can put anything in, but to get out a *Node you need to cast:

const node: ?*Node = @ptrCast(@alignCast(tail))

see also: Avoid "dependency loop detected" with function pointers - #4 by dimdin

1 Like