Skip to content

[cxx-interop] Treat un-instantiated templated types as unsafe #64897

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 4, 2023

Conversation

egorzhdan
Copy link
Contributor

When determining whether a C++ method is safe to be imported, we look at its return type to see if it stores any pointers in its fields.

If the type is templated, we might not have its definition available yet. Unfortunately we cannot instantiate it on the spot, since the Clang AST would be read and written at the same time.

Let's stay on the safe side and treat such methods as unsafe.

rdar://107609381

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Apr 4, 2023
@egorzhdan egorzhdan requested review from zoecarver and hyp as code owners April 4, 2023 13:47
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

When determining whether a C++ method is safe to be imported, we look at its return type to see if it stores any pointers in its fields.

If the type is templated, we might not have its definition available yet. Unfortunately we cannot instantiate it on the spot, since the Clang AST would be read and written at the same time.

Let's stay on the safe side and treat such methods as unsafe.

rdar://107609381
@egorzhdan egorzhdan force-pushed the egorzhdan/pointy-is-scary branch from 7de61ac to c813254 Compare April 4, 2023 14:33
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

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