From 17736a1eb45b209c9957214ebb7455ade54fdcc4 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 18 Nov 2014 01:46:52 +0100 Subject: [PATCH] fixes #1274 --- compiler/ccgexprs.nim | 2 +- tests/objects/tobjconstr2.nim | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 7d704c15ba..bced6d50f3 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1125,7 +1125,7 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) = ty = getUniqueType(ty.sons[0]) if field == nil or field.loc.r == nil: internalError(e.info, "genObjConstr") if it.len == 3 and optFieldCheck in p.options: - genFieldCheck(p, it.sons[2], r, field) + genFieldCheck(p, it.sons[2], tmp2.r, field) app(tmp2.r, ".") app(tmp2.r, field.loc.r) tmp2.k = locTemp diff --git a/tests/objects/tobjconstr2.nim b/tests/objects/tobjconstr2.nim index 8ef7004e40..39683ddc5c 100644 --- a/tests/objects/tobjconstr2.nim +++ b/tests/objects/tobjconstr2.nim @@ -32,3 +32,19 @@ type size: tuple[w, h: float] var d = Graphic(kind: 1, size: (12.9, 6.9)) + +# bug #1274 +type + K = enum Koo, Kar + Graphic2 = object of RootObj + case kind: K + of Koo: + radius: float + of Kar: + size: tuple[w, h: float] + +type NamedGraphic = object of Graphic2 + name: string + +var ngr = NamedGraphic(kind: Koo, radius: 6.9, name: "Foo") +echo ngr.name