diff options
author | Bung <crc32@qq.com> | 2023-08-27 22:56:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-27 22:56:50 +0800 |
commit | 100eb6820c271bbd1c02a8e6a9001fc5a08a2637 (patch) | |
tree | b95087ca5eb42826ab392de1a685158552f879e4 | |
parent | 0b78b7f595ef96a9769e0d59167239c611b9857a (diff) | |
download | Nim-100eb6820c271bbd1c02a8e6a9001fc5a08a2637.tar.gz |
close #9334 (#22565)
-rw-r--r-- | tests/closure/t9334.nim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/closure/t9334.nim b/tests/closure/t9334.nim new file mode 100644 index 000000000..36a9a7d77 --- /dev/null +++ b/tests/closure/t9334.nim @@ -0,0 +1,19 @@ +discard """ + cmd: "nim $target --hints:off $options -r $file" + nimout: '''@[1] +@[1, 1] +''' + nimoutFull: true +""" +proc p(s: var seq[int]): auto = + let sptr = addr s + return proc() = sptr[].add 1 + +proc f = + var data = @[1] + p(data)() + echo repr data + +static: + f() # prints [1] +f() # prints [1, 1] |