diff options
author | Araq <rumpf_a@web.de> | 2014-11-18 01:46:52 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-11-18 01:46:52 +0100 |
commit | 17736a1eb45b209c9957214ebb7455ade54fdcc4 (patch) | |
tree | 2e4cb24331ec5442b10c529eb2f80fe3ac43999d | |
parent | c5cc20d33797f094a742c0a7f39a59e867a380f7 (diff) | |
download | Nim-17736a1eb45b209c9957214ebb7455ade54fdcc4.tar.gz |
fixes #1274
-rw-r--r-- | compiler/ccgexprs.nim | 2 | ||||
-rw-r--r-- | tests/objects/tobjconstr2.nim | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 7d704c15b..bced6d50f 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 8ef7004e4..39683ddc5 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 |