diff options
-rw-r--r-- | lib/nimbase.h | 2 | ||||
-rw-r--r-- | tests/ccgbugs/t5345.nim | 10 | ||||
-rw-r--r-- | tests/ccgbugs/t5701.nim | 17 |
3 files changed, 29 insertions, 0 deletions
diff --git a/lib/nimbase.h b/lib/nimbase.h index 84972fcb0..507108712 100644 --- a/lib/nimbase.h +++ b/lib/nimbase.h @@ -107,6 +107,8 @@ __clang__ # define N_INLINE(rettype, name) rettype __inline name #endif +#define N_INLINE_PTR(rettype, name) rettype (*name) + #if defined(__POCC__) # define NIM_CONST /* PCC is really picky with const modifiers */ # undef _MSC_VER /* Yeah, right PCC defines _MSC_VER even if it is diff --git a/tests/ccgbugs/t5345.nim b/tests/ccgbugs/t5345.nim new file mode 100644 index 000000000..f9ee833c4 --- /dev/null +++ b/tests/ccgbugs/t5345.nim @@ -0,0 +1,10 @@ +discard """ + output: true +""" + +proc cmpx(d: int): bool {.inline.} = d > 0 + +proc abc[C](cx: C, d: int) = + echo cx(d) + +abc(cmpx, 10) 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) |