mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
fixes #366
This commit is contained in:
@@ -1088,7 +1088,10 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
|
||||
tmp2.s = onHeap
|
||||
tmp2.heapRoot = tmp.r
|
||||
expr(p, it.sons[1], tmp2)
|
||||
genAssignment(p, d, tmp, {})
|
||||
if d.k == locNone:
|
||||
d = tmp
|
||||
else:
|
||||
genAssignment(p, d, tmp, {})
|
||||
|
||||
proc genSeqConstr(p: BProc, t: PNode, d: var TLoc) =
|
||||
var arr: TLoc
|
||||
|
||||
8
tests/compile/tobjconstr2.nim
Normal file
8
tests/compile/tobjconstr2.nim
Normal file
@@ -0,0 +1,8 @@
|
||||
type TFoo{.exportc.} = object
|
||||
x:int
|
||||
|
||||
var s{.exportc.}: seq[TFoo] = @[]
|
||||
|
||||
s.add TFoo(x: 42)
|
||||
|
||||
echo s[0].x
|
||||
Reference in New Issue
Block a user