-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tuple of enum created with @Type and single field can't be initialized #19985
Labels
Milestone
Comments
Here is a larger repro of original code which has the same issue. test {
const S = struct { foo: u8 };
var s: S = undefined;
const Fe = std.meta.FieldEnum(S);
const name = "foo";
const fe = std.meta.stringToEnum(Fe, name) orelse return error.InvalidField;
switch (fe) {
inline else => |tag| {
@field(s, @tagName(tag)) = 42;
},
}
try std.testing.expectEqual(42, s.foo);
} |
Not sure when it was fixed, but both of these tests now compile and pass with 0.14.0-dev.2435+7575f2121. 🎉 |
travisstaloch
added a commit
to travisstaloch/flagset
that referenced
this issue
Dec 25, 2024
ziglang/zig#19985 seems to have been fixed.
this should prolly have test coverage added to https://github.com/ziglang/zig/blob/master/test/behavior/type.zig just to be sure |
travisstaloch
added a commit
to travisstaloch/zig
that referenced
this issue
Dec 25, 2024
travisstaloch
added a commit
to travisstaloch/zig
that referenced
this issue
Dec 25, 2024
andrewrk
pushed a commit
that referenced
this issue
Dec 29, 2024
Fri3dNstuff
pushed a commit
to Fri3dNstuff/zig
that referenced
this issue
Jan 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Zig Version
0.13.0-dev.75+5c9eb4081
Steps to Reproduce and Observed Behavior
/tmp/tmp.zig
Expected Behavior
This should work considering that the above works with
enum { foo }
andenum(u0) { foo }
.The text was updated successfully, but these errors were encountered: