Skip to content

Cherrypick fixes for issue 74866 to release/5.10 #77277

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

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/ClangImporter/ClangImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5487,6 +5487,13 @@ cloneBaseMemberDecl(ValueDecl *decl, DeclContext *newContext) {
(fn->getClangDecl() &&
isa<clang::FunctionTemplateDecl>(fn->getClangDecl())))
return nullptr;
if (auto cxxMethod =
dyn_cast_or_null<clang::CXXMethodDecl>(fn->getClangDecl())) {
// FIXME: if this function has rvalue this, we won't be able to synthesize
// the accessor correctly (https://github.com/apple/swift/issues/69745).
if (cxxMethod->getRefQualifier() == clang::RefQualifierKind::RQ_RValue)
return nullptr;
}

ASTContext &context = decl->getASTContext();
auto out = FuncDecl::createImplicit(
Expand Down Expand Up @@ -7070,6 +7077,11 @@ static bool isSufficientlyTrivial(const clang::CXXRecordDecl *decl) {
/// Checks if a record provides the required value type lifetime operations
/// (copy and destroy).
static bool hasCopyTypeOperations(const clang::CXXRecordDecl *decl) {
// Hack for a base type of std::optional from the Microsoft standard library.
if (decl->isInStdNamespace() && decl->getIdentifier() &&
decl->getName() == "_Optional_construct_base")
return true;

// If we have no way of copying the type we can't import the class
// at all because we cannot express the correct semantics as a swift
// struct.
Expand Down
Loading