Skip to content

Conversation

@Rua
Copy link
Contributor

@Rua Rua commented Nov 4, 2025

This combines handling of the address-of and array-decay cast into a common function.

In the current code, this check for whether the created pointer type has a different pointee than the actual desired pointee type is only applied to array-to-pointer decays but not address-of. I left it that way, but perhaps it's also good to have it for address-of?

// If the target pointee type is different from the source element type,
// then we need to cast the ptr type as well.
if arg_cty_kind.element_ty().map_or(false, |arg_element_cty| {
arg_element_cty != pointee_cty.ctype
}) {
needs_cast = true;
}

@Rua Rua force-pushed the addr-of-refactor branch 2 times, most recently from 8380ec4 to 79fb5bb Compare November 4, 2025 11:06
@Rua Rua force-pushed the addr-of-refactor branch 7 times, most recently from 7cb37b8 to de8c25a Compare November 5, 2025 18:46
@Rua Rua force-pushed the addr-of-refactor branch 2 times, most recently from 72a0412 to 07d7881 Compare November 6, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant