Skip to content

checker: fix infix arithmetic on explicit struct pointers#26810

Merged
JalonSolov merged 1 commit into
vlang:masterfrom
wenxuanjun:fix-struct-pointer-arithmetic
Apr 20, 2026
Merged

checker: fix infix arithmetic on explicit struct pointers#26810
JalonSolov merged 1 commit into
vlang:masterfrom
wenxuanjun:fix-struct-pointer-arithmetic

Conversation

@wenxuanjun
Copy link
Copy Markdown
Contributor

Allow infix pointer arithmetic on explicit struct pointers and pointers to struct pointers.

Previously, pointer arithmetic only worked with primitive pointers like &int or &&int, but now it also works with struct pointers like &Struct and &&Struct.

This change keeps the fix local to infix pointer arithmetic:

  • explicit struct pointers now work with + and -
  • safe code still reports the existing unsafe warning
  • invalid pointer operators like % continue to fail, but without the extra mismatched-type noise

@JalonSolov JalonSolov closed this Apr 6, 2026
@JalonSolov JalonSolov reopened this Apr 6, 2026
@JalonSolov JalonSolov merged commit 219dcb1 into vlang:master Apr 20, 2026
147 of 186 checks passed
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.

2 participants