Open mrousavy opened 1 month ago
In the generated -Swift.h header, Swift properly parses C++ types such as std::vector<T>:
-Swift.h
std::vector<T>
+ SWIFT_INLINE_THUNK std::__1::vector<double, std::allocator<double>> getNumbers() SWIFT_SYMBOL("s:10NitroImage34HybridSwiftKotlinTestObjectSpecCxxC10getNumbersSo3stdO3__1O0044vectorCDoubleallocatorCDouble_xDFGkvkyqsaJeaVyF");
..however when using an std::tuple, it accidentally generates one template angled brackets too many (std::tuple<<..>> instead of std::tuple<..>):
std::tuple
std::tuple<<..>>
std::tuple<..>
- SWIFT_INLINE_THUNK std::__1::tuple<<double, double, std::string>> getTuple() SWIFT_SYMBOL("s:10NitroImage34HybridSwiftKotlinTestObjectSpecCxxC8getTupleSo3stdO3__1O0014tuple__AuJCaraVyF"); ^ ❌
..which causes the build to fail.
// specializations as templates cannot be used in swift yet using std__vector_double_ = std::vector<double>; using std__tuple_double__double__std__string_ = std::tuple<double, double, std::string>;
func getNumbers() -> std__vector_double_ { return helpers.create_std__vector_double_() } func getTuple() -> std__tuple_double__double__std__string_ { return helpers. std__tuple_double__double__std__string_() }
I expect the tuple to be properly generated in the -Swift.h header, like so:
SWIFT_INLINE_THUNK std::__1::tuple<double, double, std::string> getTuple() SWIFT_SYMBOL("s:10NitroImage34HybridSwiftKotlinTestObjectSpecCxxC8getTupleSo3stdO3__1O0014tuple__AuJCaraVyF");
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4) Target: arm64-apple-macosx14.0
No response
Same goes for std::variant<A, B> btw:
std::variant<A, B>
SWIFT_INLINE_THUNK std::__1::variant<<std::string, double>> HybridSwiftKotlinTestObjectSpecCxx::getSomeVariant() {
Description
In the generated
-Swift.h
header, Swift properly parses C++ types such asstd::vector<T>
:..however when using an
std::tuple
, it accidentally generates one template angled brackets too many (std::tuple<<..>>
instead ofstd::tuple<..>
):..which causes the build to fail.
Reproduction
Expected behavior
I expect the tuple to be properly generated in the
-Swift.h
header, like so:Environment
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4) Target: arm64-apple-macosx14.0
Additional information
No response