tfinalobj.nim 489 B

123456789101112131415161718192021222324252627282930313233
  1. discard """
  2. output: '''abc
  3. 16 == 16'''
  4. """
  5. type
  6. TA = object {.pure, final.}
  7. x: string
  8. var
  9. a: TA
  10. a.x = "abc"
  11. doAssert TA.sizeof == string.sizeof
  12. echo a.x
  13. ##########################################
  14. # bug #9794
  15. ##########################################
  16. type
  17. imported_double {.importc: "double".} = object
  18. Pod = object
  19. v* : imported_double
  20. seed*: int32
  21. Pod2 = tuple[v: imported_double, seed: int32]
  22. proc test() =
  23. echo sizeof(Pod), " == ",sizeof(Pod2)
  24. test()