This commit is contained in:
Andreas Rumpf
2016-05-11 20:50:03 +02:00
parent 38040e7691
commit 11d0f3f7ec
2 changed files with 3 additions and 1 deletions

View File

@@ -570,6 +570,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var IntSet): Rope =
of tyRange, tyEnum:
let t = if t.kind == tyRange: t.lastSon else: t
result = getTypeName(t)
if isImportedCppType(t): return
idTablePut(m.typeCache, t, result)
var size: int
if firstOrd(t) < 0:

View File

@@ -301,7 +301,8 @@ proc resetLoc(p: BProc, loc: var TLoc) =
proc constructLoc(p: BProc, loc: TLoc, isTemp = false) =
let typ = skipTypes(loc.t, abstractRange)
if not isComplexValueType(typ):
linefmt(p, cpsStmts, "$1 = 0;$n", rdLoc(loc))
linefmt(p, cpsStmts, "$1 = ($2)0;$n", rdLoc(loc),
getTypeDesc(p.module, typ))
else:
if not isTemp or containsGarbageCollectedRef(loc.t):
# don't use memset for temporary values for performance if we can