Merge pull request #4456 from yglukhov/vm-ct-args
Fixed vm codegen for a call with compile-time args. Fixes #4412.
This commit is contained in:
commit
46237a273d
2 changed files with 10 additions and 1 deletions
|
|
@ -501,8 +501,11 @@ proc genCall(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
if dest < 0 and not isEmptyType(n.typ): dest = getTemp(c, n.typ)
|
if dest < 0 and not isEmptyType(n.typ): dest = getTemp(c, n.typ)
|
||||||
let x = c.getTempRange(n.len, slotTempUnknown)
|
let x = c.getTempRange(n.len, slotTempUnknown)
|
||||||
# varargs need 'opcSetType' for the FFI support:
|
# varargs need 'opcSetType' for the FFI support:
|
||||||
let fntyp = n.sons[0].typ
|
let fntyp = skipTypes(n.sons[0].typ, abstractInst)
|
||||||
for i in 0.. <n.len:
|
for i in 0.. <n.len:
|
||||||
|
if i > 0 and i < sonsLen(fntyp):
|
||||||
|
let paramType = fntyp.n.sons[i]
|
||||||
|
if paramType.typ.isCompileTimeOnly: continue
|
||||||
var r: TRegister = x+i
|
var r: TRegister = x+i
|
||||||
c.gen(n.sons[i], r)
|
c.gen(n.sons[i], r)
|
||||||
if i >= fntyp.len:
|
if i >= fntyp.len:
|
||||||
|
|
|
||||||
6
tests/vm/tvmmisc.nim
Normal file
6
tests/vm/tvmmisc.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
# 4412
|
||||||
|
proc default[T](t: typedesc[T]): T {.inline.} = discard
|
||||||
|
|
||||||
|
static:
|
||||||
|
var x = default(type(0))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue