Codegen fix for function pointers marked inline (#8866)
Fixes #5345 Fixes #5701
This commit is contained in:
parent
cec89d8354
commit
4aba2981dd
3 changed files with 29 additions and 0 deletions
10
tests/ccgbugs/t5345.nim
Normal file
10
tests/ccgbugs/t5345.nim
Normal file
|
|
@ -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)
|
||||
17
tests/ccgbugs/t5701.nim
Normal file
17
tests/ccgbugs/t5701.nim
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue