t8545.nim 509 B

12345678910111213141516171819202122232425
  1. discard """
  2. # just tests that this doesn't crash the compiler
  3. errormsg: "cannot instantiate: 'a:type'"
  4. """
  5. # bug #8545
  6. template bar(a: static[bool]): untyped = int
  7. proc main() =
  8. proc foo1(a: static[bool]): auto = 1
  9. doAssert foo1(true) == 1
  10. proc foo2(a: static[bool]): bar(a) = 1
  11. doAssert foo2(true) == 1
  12. proc foo3(a: static[bool]): bar(cast[static[bool]](a)) = 1
  13. doAssert foo3(true) == 1
  14. proc foo4(a: static[bool]): bar(static(a)) = 1
  15. doAssert foo4(true) == 1
  16. static: main()
  17. main()