-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
forbid unused bits in packed unions #25163
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
Conversation
packed union fields must all have matching bit sizes
|
dont the (planned?) semantics of packed structs mean any undefined bits cause the entire thing to be undefined? probably shouldnt recommend doing that in an upgrade guide |
|
Good call, thank you. |
should I disable the test for stage2_aarch64 for now? |
|
Weren't explicit packed union backing ints part of #19754? That's still a compile error after this patch |
|
Sounds like #24715 to me |
|
I thought that's just about making the tag mandatory, I was referring to this comment const U = packed union(u16) {
x: packed struct(u16) {
data: u8,
padding: u8 = 0,
},
y: u16,
};
comptime {
_ = U;
}still doesn't compile with: |
|
Sorry, you're right. There is not a proposal open which is limited to supporting backing integer type for packed unions, although several proposals imply its existence. I'll add that right now. |
closes #19754
Upgrade Guide
⬇️