Skip to content

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

Merged
andrewrk merged 1 commit into
ziglang:masterfrom
mlugg:a-gift-for-andrew
Mar 31, 2025
Merged

Sema: allow @ptrCast slice of zero-bit type to slice of non-zero-bit type#23418
andrewrk merged 1 commit into
ziglang:masterfrom
mlugg:a-gift-for-andrew

Conversation

@mlugg

Copy link
Copy Markdown
Member

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).
@alexrpalexrp added this to the 0.14.1 milestone Mar 31, 2025
@andrewrk
andrewrk merged commit d53cc5e into ziglang:masterMar 31, 2025
@mlugg
mlugg deleted the a-gift-for-andrew branch May 18, 2025 20:00
Sign up for freeto 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

@mlugg@alexrp@andrewrk