Skip to content

Conversation

@kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Jan 9, 2026

Closes #26293

When converting a value-type function argument (e.g., string) to an interface type (e.g., Value), the compiler incorrectly used direct address-of (&) operation instead of heap allocation. This caused a dangling pointer issue because the function argument is a local variable that gets destroyed when the function returns, but the interface still held a pointer to the invalidated memory, leading to runtime memory access errors.

}

fn test_interface_string_ref_arg() {
params := generate_params('[email protected]')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think using an email address (to a domain we do not control) is a good idea
Maybe switch the string to 'kbkpbot'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an assertion too. Without one, it only checks that the test compiles, but it is not clear what does it do, and what feature is tested.

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.

Runtime memory access error I can't explain

4 participants