From 6f1e9752c5a783fae14c3bba755fd5a6e0719986 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Tue, 23 Dec 2025 22:59:55 +0800 Subject: [PATCH] adds a test case --- tests/isolate/tisolaterefc.nim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/isolate/tisolaterefc.nim diff --git a/tests/isolate/tisolaterefc.nim b/tests/isolate/tisolaterefc.nim new file mode 100644 index 0000000000..76207bd9b9 --- /dev/null +++ b/tests/isolate/tisolaterefc.nim @@ -0,0 +1,29 @@ +discard """ + nimout: ''' +tisolaterefc.nim(20, 20) Warning: 'string' containing garbage-collected types cannot be isolated in refc [GcIsolated] +tisolaterefc.nim(21, 25) Warning: 'ptr string' containing garbage-collected types cannot be isolated in refc [GcIsolated] +tisolaterefc.nim(22, 20) Warning: 'Foo' containing garbage-collected types cannot be isolated in refc [GcIsolated] +tisolaterefc.nim(23, 25) Warning: 'ptr Foo' containing garbage-collected types cannot be isolated in refc [GcIsolated] +''' + matrix: "--mm:refc" +""" + +import std/isolation +type + Foo = object + id: ptr string + +proc foo() = + var x = Foo() + + var m = "24e" + var s1 = isolate(m) + var s2 = isolate(addr m) + var s3 = isolate(x) + var s4 = isolate(addr x) + discard s1 + discard s2 + discard s3 + discard s4 + +foo()