Skip to content

Conversation

@susmonteiro
Copy link
Contributor

This patch reapplies #84646 and #85236:

If a C++ type doesn't have a user provided copy constructor, Clang will declare one implicitly, unless one of its fields is not copy-constructible. Clang assumes that any std::vector is always copy-constructible, including a std::vector of a non-copy constructible type. So, let's use the CxxValueSemantics implemented in #84340 to figure out if we should ask Clang to define the copy constructor for such types.

This also includes types that have a defaulted, user-provided copy constructor.

These patches were reverted (#85331) because they triggered a cycle in the CxxValueSemantics requests. After #85485, these cycles have been prevented and we can safely re-land those patches.

rdar://151870709
rdar://152496447

@susmonteiro susmonteiro added the c++ interop Feature: Interoperability with C++ label Nov 21, 2025
@susmonteiro susmonteiro changed the title Susmonteiro/reapply implicit constructors [cxx-interop] Reapply implicitly defined copy and move constructors Nov 21, 2025
@susmonteiro
Copy link
Contributor Author

Note: this PR is a follow-up to #85485, which hasn't been merged yet. Only the last commit 67ee603 is a new addition

@susmonteiro
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