[cxx-interop] Check the presence of copy constructor correctly

This removes a longstanding workaround in the import logic for C++ structs:
Swift assumed that if a C++ struct has no copy constructor that is explicitly deleted, then the struct is copyable. This is not actually correct. This replaces the workaround with a proper check for the presence of a C++ copy constructor.

rdar://136838485
This commit is contained in:
Egor Zhdan
2024-04-26 20:05:23 +01:00
parent f66a2b11cb
commit fbbec48c76
4 changed files with 41 additions and 8 deletions

View File

@@ -1,5 +1,8 @@
// RUN: %target-swift-ide-test -print-module -module-to-print=Constructors -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
// CHECK: struct TemplatedCopyConstructor
// CHECK: struct TemplatedCopyConstructorWithExtraArg
// Make sure we don't import non-copyable types because we will have no way to
// represent and copy/move these in swift with correct semantics.
// CHECK-NOT: DeletedCopyConstructor