t16898.nim 719 B

1234567891011121314151617181920212223242526272829303132
  1. discard """
  2. errormsg: "invalid type: 'lent QuadraticExt' in this context: 'proc (r: var QuadraticExt, a: lent QuadraticExt, b: lent QuadraticExt){.noSideEffect, gcsafe.}' for proc"
  3. """
  4. # bug #16898
  5. type
  6. Fp[N: static int, T] = object
  7. big: array[N, T]
  8. type
  9. QuadraticExt* = concept x
  10. ## Quadratic Extension concept (like complex)
  11. type BaseField = auto
  12. x.c0 is BaseField
  13. x.c1 is BaseField
  14. {.experimental:"views".}
  15. func prod(r: var QuadraticExt, a, b: lent QuadraticExt) =
  16. discard
  17. type
  18. Fp2[N: static int, T] = object
  19. c0, c1: Fp[N, T]
  20. # This should be passed by reference,
  21. # but concepts do not respect the 24 bytes rule
  22. # or `byref` pragma.
  23. var r, a, b: Fp2[6, uint64]
  24. prod(r, a, b)