Skip to content

[6.2][cxx-interop] Diagnose Escapable C++ types with non-escapable fields #80710

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 14, 2025

Conversation

Xazax-hun
Copy link
Contributor

@Xazax-hun Xazax-hun commented Apr 10, 2025

Explanation: In Swift, Escapable types cannot have non-escapable stored properties. Unfortunately, these checks could be circumvented via C++ interop, constructing invalid Swift code. This patch errors out on importing C++ code of this shape.
Issue: rdar://148899224
Risk: Low, the fix is fairly targeted to the affected scenario.
Testing: Added tests to test suite
Original PR: #80671
Reviewer: John Hui

…elds

Explanation: In Swift, Escapable types cannot have non-escapable stored
properties. Unfortunately, these checks could be circumvented via C++
interop, constructing invalid Swift code. This patch errors out on
importing C++ code of this shape.
Issue: rdar://148899224
Risk: Low, the fix is fairly targeted to the affected scenario.
Testing: Added tests to test suite
Original PR: #80671
Reviewer: John Hui
@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Apr 10, 2025
@Xazax-hun Xazax-hun requested a review from a team as a code owner April 10, 2025 09:27
@Xazax-hun Xazax-hun changed the title [6.2][cxx-interop] Diagnose Escapable C++ types with non-escapable fi… [6.2][cxx-interop] Diagnose Escapable C++ types with non-escapable fields Apr 10, 2025
@Xazax-hun
Copy link
Contributor Author

@swift-ci please test

@Xazax-hun Xazax-hun requested a review from j-hui April 10, 2025 10:24
@Xazax-hun Xazax-hun added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels Apr 10, 2025
@Xazax-hun Xazax-hun merged commit 710c26e into release/6.2 Apr 14, 2025
5 checks passed
@Xazax-hun Xazax-hun deleted the gaborh/escapable-type-nonesc-field-on-6.2 branch April 14, 2025 18:10
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++ 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants