summary refs log tree commit diff stats
path: root/tests/lent/t16898.nim
blob: ea7c934efb937185c475163162ddf424ca51996c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
discard """
  errormsg: "invalid type: 'lent QuadraticExt' in this context: 'proc (r: var QuadraticExt, a: lent QuadraticExt, b: lent QuadraticExt){.noSideEffect, gcsafe, locks: 0.}' for proc"
"""

# bug #16898
type
  Fp[N: static int, T] = object
    big: array[N, T]

type
  QuadraticExt* = concept x
    ## Quadratic Extension concept (like complex)
    type BaseField = auto
    x.c0 is BaseField
    x.c1 is BaseField

{.experimental:"views".}

func prod(r: var QuadraticExt, a, b: lent QuadraticExt) =
  discard

type
  Fp2[N: static int, T] = object
    c0, c1: Fp[N, T]

# This should be passed by reference,
# but concepts do not respect the 24 bytes rule
# or `byref` pragma.
var r, a, b: Fp2[6, uint64]

prod(r, a, b)