diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-10-16 19:20:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-16 13:20:05 +0200 |
commit | 0bacdf5fdf86a01132d2817599ad0a7f155a101e (patch) | |
tree | 5838450ae4ae2611ee805a0193c84ad97580bdc0 /tests | |
parent | 619d6c318c517683ae601818e6f4af8e6383ed5e (diff) | |
download | Nim-0bacdf5fdf86a01132d2817599ad0a7f155a101e.tar.gz |
fixes #20515; base `method` requires explicit `{.gcsafe.}` to be GC-safe (#20574)
* fixes #20515; base requires explicit `{.gcsafe.}` to be GC-safe * add tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/method/t20515.nim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/method/t20515.nim b/tests/method/t20515.nim new file mode 100644 index 000000000..1921f2e46 --- /dev/null +++ b/tests/method/t20515.nim @@ -0,0 +1,20 @@ +discard """ + errormsg: "Base method 'zzz' requires explicit '{.gcsafe.}' to be GC-safe" + line: 10 +""" + +type + A = ref object of RootObj + B = ref object of A + +method zzz(a: A) {.base.} = + discard + +var s: seq[int] +method zzz(a: B) = + echo s + +proc xxx(someObj: A) {.gcsafe.} = + someObj.zzz() + +xxx(B()) |