It continues failing:
    
    
    # nim cpp -r tmp01
    import occt
    
    proc mydowncast*[A; B](this: Handle[A] ): Handle[B] {.cdecl, importcpp: 
"\'0::DownCast(@)".}
    
    proc dcast1*[T](this: auto ):T {.cdecl, importcpp: "\'0::DownCast(@)".}
    
    proc dcast2*[T](this: Handle[auto] ): Handle[T] {.cdecl, importcpp: 
"\'0::DownCast(@)".}
    
    proc dcast3*[T](this: Handle ): Handle[T] {.cdecl, importcpp: 
"\'0::DownCast(@)".}
    
    var aPnt1: Handle[Geom_Point]
    var aPnt2, aPnt3: Handle[Geom_CartesianPoint]
    
    aPnt2 = newHandle( cnew newGeomCartesianPoint(1.0,2.0,3.0) ) #
    aPnt1 = newHandle( cast[ptr Geom_Point](aPnt2.get) )
    
    
    #aPnt3 = mydowncast[Geom_Point,Geom_CartesianPoint](aPnt1)  # <-- This works
    #aPnt3 = dcast1[Handle[Geom_CartesianPoint]](aPnt1)         # <-- This 
doesn't
    #aPnt3 = dcast2[Geom_CartesianPoint](aPnt1)                 # <-- This 
doesn't
    #aPnt3 = dcast3[Geom_CartesianPoint](aPnt1)                 # <-- This 
doesn't
    
    
    Run

One thing that puzzles me is the error report:
    
    
    Error: type mismatch: got <void, Handle[geom_types.GeomPoint]>
    but expected one of:
    proc `()`(this: BitPredicate; theLink: BVH_EncodedLink): bool
      first type mismatch at position: 1
      required type for this: BitPredicate
      but expression 'dcast3[Geom_CartesianPoint]' is of type: void
    proc `()`(this: BlendFuncTensor; row: cint; col: cint; mat: cint): cfloat
      first type mismatch at position: 1
      required type for this: BlendFuncTensor
      but expression 'dcast3[Geom_CartesianPoint]' is of type: void
    proc `()`(this: ChFiDS_Map; i: cint): TopToolsListOfShape
      first type mismatch at position: 1
      required type for this: ChFiDS_Map
      but expression 'dcast3[Geom_CartesianPoint]' is of type: void
    ....
    
    
    Run

We can see that is complaining about ` 'dcast3[Geom_CartesianPoint]' is of 
type: void`. But it is trying to much the call against the operator `()`. I am 
using that experimental feature in some places across the library:
    
    
    {.experimental: "callOperator".}
    
    
    Run

Could it be a bug in Nim?

Reply via email to