* fix #15662

* alternative fix

* fix spacing
This commit is contained in:
cooldome 2020-10-23 10:14:54 +01:00 • committed by GitHub
commit ae320b4e7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 17 deletions

View file

@ -586,9 +586,6 @@ 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[0].typ, abstractInst) let fntyp = skipTypes(n[0].typ, abstractInst)
for i in 0..<n.len: for i in 0..<n.len:
#if i > 0 and i < fntyp.len:
# let paramType = fntyp.n[i]
# if paramType.typ.isCompileTimeOnly: continue
var r: TRegister = x+i var r: TRegister = x+i
c.gen(n[i], r, {gfIsParam}) c.gen(n[i], r, {gfIsParam})
if i >= fntyp.len: if i >= fntyp.len:
@ -1926,20 +1923,21 @@ proc genObjConstr(c: PCtx, n: PNode, dest: var TDest) =
proc genTupleConstr(c: PCtx, n: PNode, dest: var TDest) = proc genTupleConstr(c: PCtx, n: PNode, dest: var TDest) =
if dest < 0: dest = c.getTemp(n.typ) if dest < 0: dest = c.getTemp(n.typ)
c.gABx(n, opcLdNull, dest, c.genType(n.typ)) if n.typ.kind != tyTypeDesc:
# XXX x = (x.old, 22) produces wrong code ... stupid self assignments c.gABx(n, opcLdNull, dest, c.genType(n.typ))
for i in 0..<n.len: # XXX x = (x.old, 22) produces wrong code ... stupid self assignments
let it = n[i] for i in 0..<n.len:
if it.kind == nkExprColonExpr: let it = n[i]
let idx = genField(c, it[0]) if it.kind == nkExprColonExpr:
let tmp = c.genx(it[1]) let idx = genField(c, it[0])
c.preventFalseAlias(it[1], opcWrObj, let tmp = c.genx(it[1])
dest, idx, tmp) c.preventFalseAlias(it[1], opcWrObj,
c.freeTemp(tmp) dest, idx, tmp)
else: c.freeTemp(tmp)
let tmp = c.genx(it) else:
c.preventFalseAlias(it, opcWrObj, dest, i.TRegister, tmp) let tmp = c.genx(it)
c.freeTemp(tmp) c.preventFalseAlias(it, opcWrObj, dest, i.TRegister, tmp)
c.freeTemp(tmp)
proc genProc*(c: PCtx; s: PSym): int proc genProc*(c: PCtx; s: PSym): int

View file

@ -70,3 +70,8 @@ static: # issue #11861
var ifb2: InheritedFromBase var ifb2: InheritedFromBase
initBase(ifb2) initBase(ifb2)
doAssert(ifb2.txt == "Initialized string from base") doAssert(ifb2.txt == "Initialized string from base")
static: # issue #15662
proc a(T: typedesc) = echo T.type
a((int, int))