I'm trying to see if I can add support for static functions on C++ templates to Swift.
I added a very simple test here: Comparing apple:main...GeorgeLyon:dev/george/static-cxx-interop · apple/swift · GitHub
Which expectedly failed (because it seems like static functions on C++ templates are not supported) with:
/Volumes/Shared/Developer/Projects/Swift/swift/test/Interop/Cxx/templates/class-template-instantiation.swift:22:40: error: type 'MagicWrapper<IntWrapper>' has no member 'getStaticValuePlusArg'
expectEqual(MagicWrapper<IntWrapper>.getStaticValuePlusArg(8), 50)
~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~
The curious thing is that -print-module
does emit a static function:
@available(*, unavailable, message: "Un-specialized class templates are not currently supported. Please use a specialization of this type.")
struct MagicWrapper<T> {
}
struct MagicWrapper<IntWrapper> {
init()
init(t: IntWrapper)
var t: IntWrapper
func getValuePlusArg(_ arg: Int32) -> Int32
static func getStaticValuePlusArg(_ arg: Int32) -> Int32
}
struct IntWrapper {
init()
init(value: Int32)
func getValue() -> Int32
var value: Int32
}
typealias WrappedMagicNumberA = MagicWrapper<IntWrapper>
typealias WrappedMagicNumberB = MagicWrapper<IntWrapper>
Could someone point me in the right direction to try and fix this issue?