Skip to content

Sema: allow @ptrCast slice of zero-bit type to slice of non-zero-bit type #23418

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

Merged
merged 1 commit into from
Mar 31, 2025

Conversation

mlugg
Copy link
Member

@mlugg mlugg commented Mar 31, 2025

This is actually completely well-defined. The resulting slice always has 0 elements. The only disallowed case is casting to a slice of a zero-bit type, because in that case, you cna't figure out how many destination elements to use (and there's no valid destination length if the source slice corresponds to more than 0 bits).

…t type

This is actually completely well-defined. The resulting slice always has
0 elements. The only disallowed case is casting *to* a slice of a
zero-bit type, because in that case, you cna't figure out how many
destination elements to use (and there's *no* valid destination length
if the source slice corresponds to more than 0 bits).
@alexrp alexrp added this to the 0.14.1 milestone Mar 31, 2025
@andrewrk andrewrk merged commit d53cc5e into ziglang:master Mar 31, 2025
9 checks passed
@mlugg mlugg deleted the a-gift-for-andrew branch May 18, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants