Skip to content

🍒[cxx-interop] Do not import arithmetic operators with rvalue reference parameters #80798

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

Merged
merged 1 commit into from
Apr 15, 2025

Conversation

egorzhdan
Copy link
Contributor

@egorzhdan egorzhdan commented Apr 14, 2025

Explanation: Before this change, Swift 6.2 tried importing rvalue parameters of overloaded operators by adding the consuming: label to the parameter. This isn't valid in Swift and it was causing an assertion failure.
Scope: This changes the way C++ overloaded operators are imported.
Risk: Low, this only affects C++ operators with rvalue reference parameters.
Testing: Added a compiler test.
Issue: rdar://149020099
Reviewer: @Xazax-hun @j-hui

Original PR: #80763

…e parameters

Currently those operators are imported with a `consuming:` label, which isn't valid in Swift.

We could just remove the label from these parameters, but that introduces a source breakage due to name lookup ambiguity.

So, to avoid ambiguity, let's not import such operators into Swift.

rdar://149020099
(cherry picked from commit eb7adc7)
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Apr 14, 2025
@egorzhdan egorzhdan requested a review from a team as a code owner April 14, 2025 10:29
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan
Copy link
Contributor Author

@swift-ci please test Linux

@egorzhdan
Copy link
Contributor Author

@swift-ci please test Windows

@egorzhdan egorzhdan merged commit 928e401 into release/6.2 Apr 15, 2025
5 checks passed
@egorzhdan egorzhdan deleted the egorzhdan/6.2-rvalue-arg-operator branch April 15, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants