Skip to content

[cxx-interop] Disable rvalue references. We don't support them correc… #65578

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

Merged
merged 3 commits into from
May 4, 2023

Conversation

zoecarver
Copy link
Contributor

…tly (leading to lifetime issues). We are missing a consuming.

…tly (leading to lifetime issues). We are missing a consuming.
@zoecarver zoecarver requested review from hyp and egorzhdan as code owners May 2, 2023 06:16
@zoecarver
Copy link
Contributor Author

@swift-ci please test

@hyp
Copy link
Contributor

hyp commented May 2, 2023

Also what about rvalue this. I guess that can be disabled in a follow-up.

@zoecarver
Copy link
Contributor Author

Also what about rvalue this. I guess that can be disabled in a follow-up.

Yeah it would also be hard for a user to call an rvalue method from Swift anyway

@hyp hyp added the c++ interop Feature: Interoperability with C++ label May 2, 2023
…ointee type in Swift even if parameter's type is type alias

This finally allows std::vector.push_back to be called with the pushed value directly passed into it
@hyp hyp requested review from hborla, slavapestov and xedin as code owners May 4, 2023 01:23
@hyp hyp requested review from ravikandhadai and removed request for xedin, slavapestov and hborla May 4, 2023 01:23
@@ -2356,12 +2356,17 @@ ClangImporter::Implementation::importParameterType(
dyn_cast<clang::TemplateTypeParmType>(paramTy)) {
swiftParamTy = findGenericTypeInGenericDecls(
*this, templateParamType, genericParams, attrs, addImportDiagnosticFn);
} else if (auto refType = dyn_cast<clang::ReferenceType>(paramTy)) {
} else if (auto refType = dyn_cast<clang::ReferenceType>(paramTy)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we introduced some whitespace at the end here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's resolved in updated PR

@hyp hyp force-pushed the disable-rvalue-ref branch from 748ae86 to 50edc0b Compare May 4, 2023 01:29
@hyp
Copy link
Contributor

hyp commented May 4, 2023

@swift-ci please test

@hyp
Copy link
Contributor

hyp commented May 4, 2023

@swift-ci please test source compatibility

Copy link
Contributor

@ravikandhadai ravikandhadai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

Comment on lines +22 to +23
let _42: CInt = 42
v.push_back(_42)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just inline this literal as we do below?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I can do that in a followup. Also need to disable this for template functions too in a follow up.

Copy link
Contributor Author

@zoecarver zoecarver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Alex (apparently I can't approve my own PR 😆)

@hyp
Copy link
Contributor

hyp commented May 4, 2023

@swift-ci please test source compatibility

1 similar comment
@hyp
Copy link
Contributor

hyp commented May 4, 2023

@swift-ci please test source compatibility

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.

3 participants