t13062.nim 409 B

12345678910111213141516171819202122232425262728
  1. discard """
  2. output: "[p = nil]"
  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. echo x.repr