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

@susmonteiro
Copy link
Contributor Author

@swift-ci please smoke test Linux

@susmonteiro
Copy link
Contributor Author

@swift-ci please smoke test

@susmonteiro susmonteiro force-pushed the susmonteiro/reapply-implicit-constructors branch from 67ee603 to b436032 Compare December 2, 2025 09:09
@susmonteiro susmonteiro force-pushed the susmonteiro/reapply-implicit-constructors branch from b436032 to fbfcd4d Compare December 2, 2025 09:16
@susmonteiro
Copy link
Contributor Author

@swift-ci please smoke test

@susmonteiro susmonteiro enabled auto-merge December 2, 2025 10:04
@susmonteiro susmonteiro merged commit fd6e6b3 into swiftlang:main Dec 2, 2025
3 checks passed
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