From 11d0f3f7ec99d0f738b40391cf58cfc9c05d62ed Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Wed, 11 May 2016 20:50:03 +0200 Subject: fixes #4034 --- compiler/ccgtypes.nim | 1 + compiler/cgen.nim | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'compiler') diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index da671940a..d4c11c20d 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -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: diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 4f27a5a46..cd3117d4b 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -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 -- cgit 1.4.1-2-gfad0