Fixes #1005
This commit is contained in:
parent
21d0cc8cdf
commit
9e7c0fd2b0
2 changed files with 13 additions and 5 deletions
|
|
@ -1060,6 +1060,8 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
|
||||||
t = t.sons[0].skipTypes(abstractInst)
|
t = t.sons[0].skipTypes(abstractInst)
|
||||||
r = ropef("(*$1)", r)
|
r = ropef("(*$1)", r)
|
||||||
gcUsage(e)
|
gcUsage(e)
|
||||||
|
else:
|
||||||
|
constructLoc(p, tmp)
|
||||||
discard getTypeDesc(p.module, t)
|
discard getTypeDesc(p.module, t)
|
||||||
for i in 1 .. <e.len:
|
for i in 1 .. <e.len:
|
||||||
let it = e.sons[i]
|
let it = e.sons[i]
|
||||||
|
|
@ -1082,6 +1084,7 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
|
||||||
tmp2.s = if isRef: OnHeap else: OnStack
|
tmp2.s = if isRef: OnHeap else: OnStack
|
||||||
tmp2.heapRoot = tmp.r
|
tmp2.heapRoot = tmp.r
|
||||||
expr(p, it.sons[1], tmp2)
|
expr(p, it.sons[1], tmp2)
|
||||||
|
|
||||||
if d.k == locNone:
|
if d.k == locNone:
|
||||||
d = tmp
|
d = tmp
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,21 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''0
|
output: '''0 0
|
||||||
pre test a:test b:1 c:2 haha:3
|
pre test a:test b:1 c:2 haha:3
|
||||||
assignment test a:test b:1 c:2 haha:3
|
assignment test a:test b:1 c:2 haha:3
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type TSomeObj = object of TObject
|
# bug #1005
|
||||||
Variable: int
|
|
||||||
|
type
|
||||||
|
TSomeObj = object of TObject
|
||||||
|
a: int
|
||||||
|
PSomeObj = ref object
|
||||||
|
a: int
|
||||||
|
|
||||||
var a = TSomeObj()
|
var a = TSomeObj()
|
||||||
|
var b = PSomeObj()
|
||||||
echo a.Variable.`$`
|
echo a.a, " ", b.a
|
||||||
|
|
||||||
# bug #575
|
# bug #575
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue