tdeprecatedconverter.nim 315 B

123456789101112131415
  1. # issue #24241
  2. {.warningAsError[Deprecated]: on.}
  3. type X = distinct int
  4. converter toInt(x: X): int{.deprecated.} = int(x)
  5. template `==`(a, b: X): bool = false # this gets called so we didn't convert
  6. doAssert not (X(1) == X(2))
  7. doAssert not compiles(X(1) + X(2))
  8. doAssert not (compiles do:
  9. let x: int = X(1))