Skip to content

[cxx-interop] Import mutating dereference operators #67375

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
Jul 25, 2023

Conversation

egorzhdan
Copy link
Contributor

C++ T& operator*() is mapped to a Swift computed property var pointee: T.

Previously var pointee only had a getter, after this change it will also have a setter if the C++ type declares an overload of operator* that returns a mutable reference.

rdar://112471779

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Jul 18, 2023
@egorzhdan egorzhdan force-pushed the egorzhdan/mutable-var-pointee branch from 56cc467 to 01ecb45 Compare July 18, 2023 19:51
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan force-pushed the egorzhdan/mutable-var-pointee branch from 01ecb45 to 6c81fca Compare July 19, 2023 14:05
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan marked this pull request as ready for review July 19, 2023 14:06
@egorzhdan egorzhdan requested review from zoecarver and hyp as code owners July 19, 2023 14:06
C++ `T& operator*()` is mapped to a Swift computed property `var pointee: T`.

Previously `var pointee` only had a getter, after this change it will also have a setter if the C++ type declares an overload of `operator*` that returns a mutable reference.

rdar://112471779
@egorzhdan egorzhdan force-pushed the egorzhdan/mutable-var-pointee branch from 6c81fca to 8832d27 Compare July 19, 2023 15:13
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@hyp
Copy link
Contributor

hyp commented Jul 20, 2023

If this is not going to 5.9 this needs to be gated by a versioning scheme to prevent source breakages presumably

@egorzhdan
Copy link
Contributor Author

@hyp I couldn't come up with a case where this would cause source breakages, could you give an example?

@egorzhdan egorzhdan merged commit be34674 into main Jul 25, 2023
@egorzhdan egorzhdan deleted the egorzhdan/mutable-var-pointee branch July 25, 2023 15:20
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.

2 participants