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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

checker: disallow ptr assignments to consts with int literal vals #19160

Merged
merged 5 commits into from
Aug 17, 2023

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Aug 17, 2023

fixes #19146

馃 Generated by Copilot at 8c04366

Prevent assigning pointers to integer constants in the V compiler. Improve error message and suggestion for constant declarations.

馃 Generated by Copilot at 8c04366

  • Add a check to prevent assigning a pointer to a constant integer literal (link)
  • Provide an error message and a suggestion to specify the type for the constant value (link)

@ttytm ttytm marked this pull request as draft August 17, 2023 14:53
4 | b := &a
| ^
5 | }
Details: Specify the type for the constant value. Example:
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like these details should come after the error message.

This comment was marked as outdated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Though I should not make the added tests produce an unused error

@ttytm ttytm marked this pull request as ready for review August 17, 2023 18:55
@spytheman spytheman merged commit 4908ec5 into vlang:master Aug 17, 2023
48 checks passed
@ttytm ttytm deleted the fix/const-int-literal-ptr branch August 22, 2023 13:32
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.

C error when assigning variable to const int_type ptr
3 participants