-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Import NonCopyable*
as OpaquePointer
if noncopyable generics are disabled
#73055
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
Conversation
@swift-ci please test |
lib/ClangImporter/ImportType.cpp
Outdated
// If non-copyable generics are disabled, we cannot specify | ||
// UnsafePointer<T> with a non-copyable type T. | ||
if (pointeeType && pointeeType->isNoncopyable() && | ||
!Impl.SwiftContext.LangOpts.hasFeature(Feature::NoncopyableGenerics)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lorentey do you know if this is the right way to check whether we can use UnsafePointer<NonCopyable>
?
a18ed20
to
ec5162a
Compare
NonCopyable*
as UnsafeRawPointer
if noncopyable generics are disabledNonCopyable*
as OpaquePointer
if noncopyable generics are disabled
@swift-ci please test |
1 similar comment
@swift-ci please test |
9c21f9b
to
b0d845b
Compare
@swift-ci please test |
@swift-ci please test Windows |
b0d845b
to
fa25a5e
Compare
@swift-ci please test |
@swift-ci please test Windows |
8493c7d
to
d3ef25d
Compare
@swift-ci please test |
… generics are disabled C++ pointer type `T*` is generally imported as `Unsafe(Mutable)Pointer<T>`. However, if `T` is non-copyable in Swift (e.g. it has a deleted C++ copy constructor), using `UnsafePointer<T>` type requires noncopyable generics to be enabled. This was causing assertion failures when building SwiftCompilerSources in #72912.
…T` when adding base member accessors
d3ef25d
to
6140ba1
Compare
@swift-ci please test |
C++ pointer type
T*
is generally imported asUnsafe(Mutable)Pointer<T>
. However, ifT
is non-copyable in Swift (e.g. it has a deleted C++ copy constructor), usingUnsafePointer<T>
type requires noncopyable generics to be enabled.This was causing assertion failures when building SwiftCompilerSources in #72912.