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

[C++ interop] Cannot provide release/retain funcs for template class #62456

Closed
ktoso opened this issue Dec 8, 2022 · 1 comment
Closed

[C++ interop] Cannot provide release/retain funcs for template class #62456

ktoso opened this issue Dec 8, 2022 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ compiler The Swift compiler itself duplicate Resolution: Duplicates another issue

Comments

@ktoso
Copy link
Contributor

ktoso commented Dec 8, 2022

rdar://103106740

Let's say I have CoolVar<T>:

#define SWIFT_CXX_REF_COOLVAR   					\
    __attribute__((swift_attr("import_as_ref")))   	\
    __attribute__((swift_attr("retain:retain_CoolVar")))   \
    __attribute__((swift_attr("release:release_CoolVar")))
template <class V>
class SWIFT_CXX_REF_COOLVAR CoolVar : public ReferenceCounted<CoolVar<V>> { }

It seems we don't fine the templated functions:

template <class V>
inline void retain_CoolVar(CoolVar <V>* ptr) {
  // ... 
}

template <class V>
inline void release_CoolVar(CoolVar <V>* ptr) {
  // ... 
}

error being:

error: cannot find retain function 'retain_ CoolVar' for reference type 'CoolVar'.
@ktoso ktoso added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels c++ interop Feature: Interoperability with C++ labels Dec 8, 2022
@ktoso
Copy link
Contributor Author

ktoso commented Dec 8, 2022

I'm dumb, we track this already: #61620

@ktoso ktoso closed this as completed Dec 8, 2022
@AnthonyLatsis AnthonyLatsis added duplicate Resolution: Duplicates another issue compiler The Swift compiler itself and removed triage needed This issue needs more specific labels labels Dec 8, 2022
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++ compiler The Swift compiler itself duplicate Resolution: Duplicates another issue
Projects
None yet
Development

No branches or pull requests

2 participants