typedescs.nim 578 B

1234567891011121314151617181920212223
  1. # bug #1774
  2. proc p(T: typedesc) = discard
  3. p(type((5, 6))) # Compiles
  4. (type((5, 6))).p # Doesn't compile (SIGSEGV: Illegal storage access.)
  5. type T = type((5, 6)) # Doesn't compile (SIGSEGV: Illegal storage access.)
  6. block: # issue #21677
  7. type
  8. Uints = uint16|uint32
  9. template constructor(name: untyped, typ: typedesc[Uints], typ2: typedesc[Uints]) =
  10. type
  11. name = object
  12. data: typ
  13. data2: typ2
  14. proc `init name`(data: typ, data2: typ2): name =
  15. result.data = data
  16. result.data2 = data2
  17. constructor(Test, uint32, uint16)