summary refs log tree commit diff stats
path: root/tests/ccgbugs/t5701.nim
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2018-09-04 15:28:14 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-09-04 15:28:14 +0200
commit4aba2981dd47672744191bd17b39bb149f494637 (patch)
treef915c2e879f4f70d3979811a56893a59c7c66438 /tests/ccgbugs/t5701.nim
parentcec89d835494bda07d7b27636a24544460574904 (diff)
downloadNim-4aba2981dd47672744191bd17b39bb149f494637.tar.gz
Codegen fix for function pointers marked inline (#8866)
Fixes #5345
Fixes #5701
Diffstat (limited to 'tests/ccgbugs/t5701.nim')
-rw-r--r--tests/ccgbugs/t5701.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ccgbugs/t5701.nim b/tests/ccgbugs/t5701.nim
new file mode 100644
index 000000000..e69acbf31
--- /dev/null
+++ b/tests/ccgbugs/t5701.nim
@@ -0,0 +1,17 @@
+discard """
+  output: '''(Field0: 1, Field1: 1)
+(Field0: 2, Field1: 2)
+(Field0: 3, Field1: 3)
+'''
+"""
+
+iterator zip[T1, T2](a: openarray[T1], b: openarray[T2]): iterator() {.inline.} =
+  let len = min(a.len, b.len)
+  for i in 0..<len:
+    echo (a[i], b[i])
+
+proc foo(args: varargs[int]) =
+  for i in zip(args,args):
+    discard
+
+foo(1,2,3)