Skip to content
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

[SILGen] Fix a bug where the wrong convention was being used for lowering a closure to a C++ function pointer #73193

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

ahatanaka
Copy link
Contributor

Use the C function pointer convention instead of the block convention.

rdar://122977380
(cherry picked from commit d76dbb1)

…ring a closure to a C++ function pointer (#73039)

Use the C function pointer convention instead of the block convention.

rdar://122977380
(cherry picked from commit d76dbb1)
@ahatanaka ahatanaka requested a review from a team as a code owner April 23, 2024 00:34
@ahatanaka
Copy link
Contributor Author

@swift-ci please test

@ahatanaka
Copy link
Contributor Author

Explanation: Swift compiler crashes when a swift closure is passed to a C++ function that takes a pointer to a function taking a non-trivial C++ type like std:vector<int>. The crash is caused by a bug where the block convention is used instead of the C function pointer convention to get the SIL function type.
Scope: The change I made impacts SILGen.
Original PR: #73039
Risk: Low.
Testing: Added a compiler test.
Reviewer: @egorzhdan @DougGregor

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Apr 24, 2024
@ahatanaka ahatanaka merged commit 1580719 into release/6.0 Apr 25, 2024
5 checks passed
@ahatanaka ahatanaka deleted the closure-to-cxx-function-pointer branch April 25, 2024 00:05
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.

3 participants