Skip to content
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

Pointer operations must be wrapped in unsafe #19819

Closed
ArtemkaKun opened this issue Nov 9, 2023 · 0 comments · Fixed by #19830
Closed

Pointer operations must be wrapped in unsafe #19819

ArtemkaKun opened this issue Nov 9, 2023 · 0 comments · Fixed by #19830
Labels
Bug This tag is applied to issues which reports bugs. Unit: Type System Bugs/feature requests, that are related to the V types system.

Comments

@ArtemkaKun
Copy link
Contributor

ArtemkaKun commented Nov 9, 2023

Describe the bug

The code below shows how to mutate variable that wasn't marked as mut. Since V is considered to be a secure language, pointer operations like below must be wrapped in unsafe block so it will be clear for end programmer what is going on

Reproduction Steps

c := 0
cref := &c
(*cref)++

println(c)

Expected Behavior

Outputs warning, outputs 1

Current Behavior

No warning, outputs 1

Possible Solution

No response

Additional Information/Context

No response

V version

0.4.2

Environment details (OS name and version, etc.)

Unrelated

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.

@ArtemkaKun ArtemkaKun added Bug This tag is applied to issues which reports bugs. Unit: Type System Bugs/feature requests, that are related to the V types system. labels Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Unit: Type System Bugs/feature requests, that are related to the V types system.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant