Closed
Description
Previous ID | SR-12591 |
Radar | rdar://problem/62202423 |
Original Reporter | martinboehme (JIRA User) |
Type | Task |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Task, CxxInterop |
Assignee | scentini (JIRA) |
Priority | Medium |
md5: 7f01d1c5641863738cdc55d27ea738ef
Sub-Tasks:
- SR-12592 [C++] Bind the Swift struct to the Clang AST node for the template specialization
- SR-12593 [C++] Trigger instantiation of template specializations
- SR-12594 [C++] Ensure that IRGen emits LLVM IR for functions from class template specializations
Issue Description:
Swift should be able to import C++ typedefs to class templates specializations. This feature unlocks some useful uses cases, for example std::string
, which is defined as
using std::string = std::basic_string<char>;
std::string
would be imported into Swift as a concrete type, struct string
, i.e. the underlying template would not be visible for the time being. This trick is forward-compatible: any code using the imported struct string
type would continue to work once we are able to import C++ templates as Swift generics; at that point, string
would be defined as typealias string = basic_string<CChar>
in Swift.