diff options
-rw-r--r-- | compiler/vmgen.nim | 5 | ||||
-rw-r--r-- | tests/vm/tvmmisc.nim | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index d4966b3e3..c63182b0c 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -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: diff --git a/tests/vm/tvmmisc.nim b/tests/vm/tvmmisc.nim new file mode 100644 index 000000000..e935013c4 --- /dev/null +++ b/tests/vm/tvmmisc.nim @@ -0,0 +1,6 @@ + +# 4412 +proc default[T](t: typedesc[T]): T {.inline.} = discard + +static: + var x = default(type(0)) |