From 8771451701d1c9081282d6e9d5cb626bb636da19 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Fri, 22 May 2026 10:32:14 +0800 Subject: [PATCH] closes #25294; adds a test case (#25833) closes #25294 --- tests/ccgbugs2/m25294/c.nim | 13 +++++++++++++ tests/ccgbugs2/m25294/t.nim | 5 +++++ tests/ccgbugs2/t25294.nim | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 tests/ccgbugs2/m25294/c.nim create mode 100644 tests/ccgbugs2/m25294/t.nim create mode 100644 tests/ccgbugs2/t25294.nim 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