mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
Fixed vm codegen for a call with compile-time args. Fixes #4412.
This commit is contained in:
@@ -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)
|
||||
let x = c.getTempRange(n.len, slotTempUnknown)
|
||||
# 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:
|
||||
if i > 0 and i < sonsLen(fntyp):
|
||||
let paramType = fntyp.n.sons[i]
|
||||
if paramType.typ.isCompileTimeOnly: continue
|
||||
var r: TRegister = x+i
|
||||
c.gen(n.sons[i], r)
|
||||
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))
|
||||
Reference in New Issue
Block a user