You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would not be a crazy feature, I am personally indifferent to whether or not it should be supported.
However, the actual behavior of these default field tuples is not what one would reasonably expect. This leads me to believe that we don't actually intend to support them right now, but are failing to reject them by mistake.
The currently intended behavior for tuples (discussed in some compiler meeting waaaaayyyy back when) is to not permit default values, except in comptime fields. This has been on my list as a part of a bigger refactor around anon structs for a while (I don't see myself getting to it soon, so others are free to take it up).
Zig Version
0.14.0-dev.453+eda846b86
Steps to Reproduce and Observed Behavior
The compiler currently allows code like this:
This would not be a crazy feature, I am personally indifferent to whether or not it should be supported.
However, the actual behavior of these default field tuples is not what one would reasonably expect. This leads me to believe that we don't actually intend to support them right now, but are failing to reject them by mistake.
For example, this case fails to compile:
Furthermore, if instead of building Zig from C++ I self host it, the compiler crashes on the same code (0.14.0-dev.437+d9bd34fd0):
Expected Behavior
I expected default tuple fields to be rejected by the compiler.
The text was updated successfully, but these errors were encountered: