fixes #4462
This commit is contained in:
parent
b47d9b7b91
commit
857b0c8d4c
2 changed files with 16 additions and 4 deletions
|
|
@ -518,9 +518,9 @@ proc genCall(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
# varargs need 'opcSetType' for the FFI support:
|
# varargs need 'opcSetType' for the FFI support:
|
||||||
let fntyp = skipTypes(n.sons[0].typ, abstractInst)
|
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):
|
#if i > 0 and i < sonsLen(fntyp):
|
||||||
let paramType = fntyp.n.sons[i]
|
# let paramType = fntyp.n.sons[i]
|
||||||
if paramType.typ.isCompileTimeOnly: continue
|
# 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:
|
||||||
|
|
@ -1797,6 +1797,8 @@ proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) =
|
||||||
genConv(c, n, n.sons[1], dest, opcCast)
|
genConv(c, n, n.sons[1], dest, opcCast)
|
||||||
else:
|
else:
|
||||||
globalError(n.info, errGenerated, "VM is not allowed to 'cast'")
|
globalError(n.info, errGenerated, "VM is not allowed to 'cast'")
|
||||||
|
of nkTypeOfExpr:
|
||||||
|
genTypeLit(c, n.typ, dest)
|
||||||
else:
|
else:
|
||||||
globalError(n.info, errGenerated, "cannot generate VM code for " & $n)
|
globalError(n.info, errGenerated, "cannot generate VM code for " & $n)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
|
|
||||||
# 4412
|
|
||||||
|
# bug #4462
|
||||||
|
import macros
|
||||||
|
|
||||||
|
proc foo(t: typedesc) {.compileTime.} =
|
||||||
|
echo getType(t).treeRepr
|
||||||
|
|
||||||
|
static:
|
||||||
|
foo(int)
|
||||||
|
|
||||||
|
# #4412
|
||||||
proc default[T](t: typedesc[T]): T {.inline.} = discard
|
proc default[T](t: typedesc[T]): T {.inline.} = discard
|
||||||
|
|
||||||
static:
|
static:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue