Open swift-ci opened 4 years ago
Comment by Marcel Hlopko (JIRA)
PR https://github.com/apple/swift/pull/33284 implements basic support for instantiating C++ class templates from Swift.
What doesn't work is:
template template parameters - Currently C++ class templates are imported as generic structs, and Swift cannot substitute generic arguments with a generic struct with unsubstituted arguments.
non-type parameters - Currently, Swift only allows types as generic arguments.
variadic parameters - Currently clang importer will not notice the parameter is variadic and will expect that there is only one parameter. There's no way to use specializations with more or fewer parameters from Swift.
nested types of instantiated templates cannot be serialized/deserialized in modules (therefore they cannot be used across module interface)
@swift-ci create
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | New Feature, CxxInterop | |Assignee | scentini (JIRA) | |Priority | Medium | md5: 55b08f175ae8509127468b5b5b9af809Issue Description:
I.e. allow using following C++ header:
in Swift like:
In the initial version we'll only support passing C++ types as template arguments, plus a small hardcoded set of Swift primitive types (converted to corresponding C++ types behind the scenes).