Skip to content

Deprecate operator & for getting addresses#10206

Draft
aidanfnv wants to merge 6 commits intoshader-slang:masterfrom
aidanfnv:fix/deprecate-ampersand-address-of
Draft

Deprecate operator & for getting addresses#10206
aidanfnv wants to merge 6 commits intoshader-slang:masterfrom
aidanfnv:fix/deprecate-ampersand-address-of

Conversation

@aidanfnv
Copy link
Copy Markdown
Contributor

@aidanfnv aidanfnv commented Feb 25, 2026

The prefix & operator for taking addresses has unclear semantics on GPU targets and is not intended to be part of the Slang language going forward.

This change adds an unconditional error (30086: "the '&' operator for taking addresses is no longer supported in Slang") when the resolved function has KnownBuiltinDeclName::OperatorAddressOf, emitted from CheckInvokeExprWithCheckedOperands. The operator& declaration itself is unchanged. Internal code uses __getAddress instead.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 25, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@aidanfnv aidanfnv added the pr: breaking change PRs with breaking changes label Feb 25, 2026
@dubiousconst282
Copy link
Copy Markdown
Contributor

For clarification, is this deprecating overloading support for this particular operator, or just addressing of arbitrary L-values? Full removal would be a bit unfortunate since it's not that uncommon that I write code like int* a = &ptr[offset] or &pStruct->array[0] around pointers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: breaking change PRs with breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants