Mutable sum types passed to a function can't be modified #23982
Labels
Bug
This tag is applied to issues which reports bugs.
Status: Confirmed
This bug has been confirmed to be valid by a contributor.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Describe the bug
We pass mutable sum types to a function to update the types fields and cannot be modified.
Reproduction Steps
Function
init
above tries to initialize every sum type received but can't do it. Functioninit_int
works.Expected Behavior
Mutable fields passed to init function should be set to zero for integer sum type and empty for string sum type.
Current Behavior
Mutable fields passed to init function are not set to 0 or empty string.
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.9 86bb2d7
Environment details (OS name and version, etc.)
https://play.vlang.io/p/cfbb7907ac
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: