Closed
Description
Zig Version
0.13.0-dev.75+5c9eb4081
Steps to Reproduce and Observed Behavior
/tmp/tmp.zig
test {
// these work fine
// const E = enum { foo };
// const E = enum(u0) { foo };
const E = @Type(.{ .Enum = .{
.tag_type = u0,
.is_exhaustive = true,
.fields = &.{.{ .name = "foo", .value = 0 }},
.decls = &.{},
} });
const s: struct { E } = .{.foo};
_ = s;
}
$ zig test /tmp/tmp.zig
/tmp/tmp.zig:90:32: error: value stored in comptime field does not match the default value of the field
const s: struct { E } = .{.foo};
~^~~
Expected Behavior
This should work considering that the above works with enum { foo }
and enum(u0) { foo }
.