c3c
c3c copied to clipboard
Bitstruct restrictive casting
bitstruct Foo : int {
bool a;
}
bitstruct Bar : int {
bool a;
bool b;
}
fn void bitstruct_cast() {
Bar bar;
Foo foo = (Foo)(int)bar;
// ^^^^^^^^^^^^^
// Error: You cannot cast 'Bar' to 'Foo'
// This is fine:
int bar_int = (int)bar;
Foo foo = (Foo)bar_int;
}
Is this intentional or a bug?
Actually I forgot bitcast could also be applied here. But this is still a little confusing.
That looks like a bug.
Does this work now?
Looks good now, thanks.