work-around for defining imported types with weak covariance

This commit is contained in:
Zahary Karadjov
2017-05-13 15:46:08 +03:00
parent 0aede22e87
commit b428da2cc2
2 changed files with 23 additions and 4 deletions

View File

@@ -44,7 +44,7 @@ template acceptWithCovariance(x, otherwise): typed =
skipElse(otherwise)
type
Animal = object of TObject
Animal = object of RootObj
x: string
Dog = object of Animal
@@ -302,12 +302,15 @@ reject wantsVarPointer2(pcat)
{.emit: """
template <class T> struct FN { typedef void (*type)(T); };
template <class T> struct ARR { typedef T type[2]; };
template <class T> struct ARR { typedef T DataType[2]; DataType data; };
""".}
type
MyPtr {.importcpp: "'0 *"} [out T] = distinct ptr T
MySeq {.importcpp: "ARR<'0>::type"} [out T] = object
MyPtr {.importcpp: "'0 *"} [out T] = object
MySeq {.importcpp: "ARR<'0>", nodecl} [out T] = object
data: array[2, T]
MyAction {.importcpp: "FN<'0>::type"} [in T] = object
var