t13062.nim 544 B

12345678910111213141516171819202122232425262728293031
  1. discard """
  2. matrix: "--mm:refc; --mm:orc"
  3. targets: "c cpp"
  4. """
  5. import atomics
  6. type
  7. Pledge* {.exportc.} = object
  8. p: PledgePtr
  9. PledgeKind {.exportc.} = enum
  10. Single
  11. Iteration
  12. PledgePtr {.exportc.} = ptr object
  13. case kind: PledgeKind
  14. of Single:
  15. impl: PledgeImpl
  16. of Iteration:
  17. discard
  18. PledgeImpl {.exportc.} = object
  19. fulfilled: Atomic[bool]
  20. var x: Pledge
  21. when defined(gcRefc):
  22. doAssert x.repr == "[p = nil]"
  23. elif not defined(cpp): # fixme # bug #20081
  24. doAssert x.repr == "Pledge(p: nil)"