Skip to content
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

[interop] regression: templated method that returns an owned type is marked as unsafe #64316

Open
hyp opened this issue Mar 13, 2023 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ c++ to swift Feature → c++ interop: c++ to swift compiler The Swift compiler itself regression swift 5.9 unexpected behavior Bug: Unexpected behavior or incorrect output

Comments

@hyp
Copy link
Contributor

hyp commented Mar 13, 2023

After #64300, a C++ method that returns an owned type as a dependent return type in a class template is marked as unsafe.

Example:

struct SWIFT_CXX_IMPORT_OWNED OwnedType {
};

template<class T>
class MyContainer {
public:
  T pop() { ... }
};

using MyContainerOfOwned = MyContainer<OwnedType>; // MyContainerOfOwned.pop is marked as unsafe in Swift.
@hyp hyp added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ triage needed This issue needs more specific labels labels Mar 13, 2023
@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler itself swift 5.9 unexpected behavior Bug: Unexpected behavior or incorrect output regression c++ to swift Feature → c++ interop: c++ to swift and removed triage needed This issue needs more specific labels labels Mar 13, 2023
@AnthonyLatsis
Copy link
Collaborator

@hyp I think you pasted in the wrong description. What’s an "owned" type in C++, by the way?

@hyp
Copy link
Contributor Author

hyp commented Mar 13, 2023

@AnthonyLatsis good catch, fixed. "Owned" type is a classification of a C++ type according to the C++ interoperability vision document: https://forums.swift.org/t/a-forward-vision-for-c-and-swift-interoperability/62150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ c++ to swift Feature → c++ interop: c++ to swift compiler The Swift compiler itself regression swift 5.9 unexpected behavior Bug: Unexpected behavior or incorrect output
Projects
None yet
Development

No branches or pull requests

3 participants