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
The compiler currently errors when an enum is declared as non-exhaustive (with pseudo-member _) while specifying every possible value as state.
However, this error doesn't trigger when the backing type is a zero-bit type (u0 or i0):
comptime {
_=enum(u0) { a, _ };
_=enum(u1) { a, b, _ };
}
main.zig:3:9: error: non-exhaustive enum specifies every value
_ = enum(u1) { a, b, _ };
^~~~~~~~~~~~~~~~~~~~
Expected Behavior
main.zig:2:9: error: non-exhaustive enum specifies every value
_ = enum(u0) { a, _ };
^~~~~~~~~~~~~~~~~
Note that the same error is present for instantiation via @Type; I assume the compiler-internal code for both places is shared, so that a fix would apply to both scenarios.
The text was updated successfully, but these errors were encountered:
rohlem
added
the
bug
Observed behavior contradicts documented or intended behavior
label
May 4, 2024
Zig Version
0.13.0-dev.46+3648d7df1, 0.12.0-dev.3182+f3227598e
Steps to Reproduce and Observed Behavior
The compiler currently errors when an enum is declared as non-exhaustive (with pseudo-member
_
) while specifying every possible value as state.However, this error doesn't trigger when the backing type is a zero-bit type (
u0
ori0
):Expected Behavior
Note that the same error is present for instantiation via
@Type
; I assume the compiler-internal code for both places is shared, so that a fix would apply to both scenarios.The text was updated successfully, but these errors were encountered: