diff --git a/tests/ccgbugs2/m25294/c.nim b/tests/ccgbugs2/m25294/c.nim new file mode 100644 index 0000000000..cd83bdd5fa --- /dev/null +++ b/tests/ccgbugs2/m25294/c.nim @@ -0,0 +1,13 @@ +template a(T: type): int = + when T is uint64: 1 else: 2 + +type + M*[T] = object + data*: seq[T] + b: seq[int] + indices*: array[a(T), int64] + U = distinct uint64 + D* = object + c: M[U] + v: array[180000, int64] + g*: M[uint64] \ No newline at end of file diff --git a/tests/ccgbugs2/m25294/t.nim b/tests/ccgbugs2/m25294/t.nim new file mode 100644 index 0000000000..1d3142b854 --- /dev/null +++ b/tests/ccgbugs2/m25294/t.nim @@ -0,0 +1,5 @@ +import ./c + +proc p*(): D = + let c = M[uint64](data: @[0], indices: [1]) + result = D(g: c) \ No newline at end of file diff --git a/tests/ccgbugs2/t25294.nim b/tests/ccgbugs2/t25294.nim new file mode 100644 index 0000000000..4c47868ee1 --- /dev/null +++ b/tests/ccgbugs2/t25294.nim @@ -0,0 +1,18 @@ +discard """ + matrix: "--mm:refc; --mm:orc" +""" + +import ./m25294/[c, t] + +block: + let a = new D + a[] = p() + discard a[] +block: + let a = new D + a[] = p() + discard a[] +block: + let a = new D + a[] = p() + discard a[] \ No newline at end of file