@alignOf
causing erroneous dependency loop error when used in self-referential union
#17874
Labels
Milestone
Zig Version
0.12.0-dev.1396+f6de3ec96
Steps to Reproduce and Observed Behavior
Create a file
bug.zig
:zig test bug.zig
This might seem logical at first, as
A
's alignment seems to be dependent onB
.However, if the implementation of
Union
is replaced with this:the compiler can correctly infer the alignment of the
x
field to be 8.Considering this works, it seems logical to assume that the
@Type
-based implementation also does.Expected Behavior
The code compiles.
The text was updated successfully, but these errors were encountered: