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
My understanding is that tagged union are created via .layout = .Auto, .tag_type = EnumDefinition, but this currently generates compiler errors indicating this union isn't tagged:
conststd=@import("std");
constBroken=@Type(.{
.Union= .{
.layout=.Auto,
.tag_type=enum { temp },
.fields= &[_]std.builtin.TypeInfo.UnionField{
.{ .name="foo", .field_type=void, .alignment=0 },
},
.decls= &.{},
},
});
comptime {
// error: switch on union which has no attached enumswitch (Broken{ .foo= {} }) {
.foo=> {},
}
}
@g-w1 mentioned that the stage1 compiler is crossreferencing against the wrong condition: #8069
Interestingly enough, this seems to work if I hijack an existing tagged union:
The text was updated successfully, but these errors were encountered:
Vexu
added
bug
Observed behavior contradicts documented or intended behavior
stage1
The process of building from source via WebAssembly and the C backend.
labels
Mar 1, 2021
Just ran into this myself and I found that you don't need to hijack an existing type, merely store the type info into a variable then pass it to @Type(t).
My understanding is that tagged union are created via
.layout = .Auto, .tag_type = EnumDefinition
, but this currently generates compiler errors indicating this union isn't tagged:@g-w1 mentioned that the stage1 compiler is crossreferencing against the wrong condition: #8069
Interestingly enough, this seems to work if I hijack an existing tagged union:
The text was updated successfully, but these errors were encountered: