Skip to content

[cxx-interop] Avoid linker errors when calling a defaulted constructor #66557

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
Jun 13, 2023

Conversation

egorzhdan
Copy link
Contributor

When a default constructor is declared, but does not have a body because it is defaulted (= default;), Swift did not emit the IR for it. This was causing linker error for types such as std::map in libstdc++ when someone tried to initialize such types from Swift.

rdar://110638499 / resolves #61412

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Jun 12, 2023
@egorzhdan egorzhdan requested review from zoecarver and hyp as code owners June 12, 2023 15:25
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

@swift-ci please test Windows

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test macOS

@egorzhdan
Copy link
Contributor Author

@swift-ci please test Windows

When a default constructor is declared, but does not have a body because it is defaulted (`= default;`), Swift did not emit the IR for it. This was causing linker error for types such as `std::map` in libstdc++ when someone tried to initialize such types from Swift.

rdar://110638499 / resolves #61412
@egorzhdan egorzhdan force-pushed the egorzhdan/irgen-defaulted-constructor branch from 7ca1163 to b459fb5 Compare June 12, 2023 19:07
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan merged commit 9220ec1 into main Jun 13, 2023
@egorzhdan egorzhdan deleted the egorzhdan/irgen-defaulted-constructor branch June 13, 2023 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.

Linker error when using std::map default constructor from Swift on Linux
2 participants