torc.nim 708 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. discard """
  2. targets: "cpp"
  3. matrix: "--gc:orc"
  4. """
  5. import std/options
  6. # bug #18410
  7. type
  8. O = object of RootObj
  9. val: pointer
  10. proc p(): Option[O] = none(O)
  11. doAssert $p() == "none(O)"
  12. # bug #17351
  13. type
  14. Foo = object of RootObj
  15. Foo2 = object of Foo
  16. Bar = object
  17. x: Foo2
  18. var b = Bar()
  19. discard b
  20. # bug #4678
  21. {.emit: """/*TYPESECTION*/
  22. enum class SomeEnum {A,B,C};
  23. """.}
  24. type
  25. EnumVector[T: enum] {.importcpp: "std::vector", header: "vector".} = object
  26. SomeEnum {.importcpp, nodecl.} = enum
  27. A,B,C
  28. proc asVector*[T](t: T): EnumVector[T] =
  29. discard
  30. # Nim generates this signature here:
  31. # N_NIMCALL(std::vector<> , asvector_106028_3197418230)(SomeEnum t0)
  32. discard asVector(SomeEnum.A)