-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Prevent usage in Swift of C++ copy constructor with default args #79325
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
35e7db5
to
47e556e
Compare
@swift-ci please smoke test |
test/Interop/Cxx/value-witness-table/copy-constructors-execution.swift
Outdated
Show resolved
Hide resolved
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.
Looks great! @Xazax-hun raised a great question, once that's addressed, this PR should be good to go.
As a side note, we'll probably need a similar change for move constructors (see hasMoveTypeOperations
), but that can be a separate patch.
47e556e
to
dacb9a6
Compare
@swift-ci please smoke test |
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.
LG!
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.
LGTM, thanks!
dacb9a6
to
f27af74
Compare
@swift-ci please smoke test |
f27af74
to
b130614
Compare
@swift-ci please smoke test |
b130614
to
51b7ac3
Compare
@swift-ci please smoke test |
IIRC, this is a fairly common pattern in some codebases, so while it's reasonable in the short term, we really do need to emit a thunk that we can call from Swift sooner rather than later. |
51b7ac3
to
bc6573e
Compare
@swift-ci please smoke test |
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.
lgtm
@swift-ci Please smoke test macOS platform |
@@ -541,12 +541,20 @@ namespace { | |||
FixedTypeInfo, ClangFieldInfo> { | |||
const clang::RecordDecl *ClangDecl; | |||
|
|||
bool hasNonFirstDefaultArg(const clang::CXXConstructorDecl *ctor) const { |
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.
Nit: is there a way to deduplicate this?
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.
I'll open a similar pr for move constructors soon. I'll see if I can fix this there.
While support for C++ copy constructors with default args in Swift isn't added, we make these C++ types non-copyable.
rdar://142414553