Skip to content

Commit

Permalink
fixes #12882 (#12889)
Browse files Browse the repository at this point in the history
* fixes #12882
  • Loading branch information
cooldome authored Dec 13, 2019
1 parent 22b2684 commit 1e1fd73
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/ccgtrav.nim
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ proc genTraverseProc(c: TTraversalClosure, accessor: Rope, typ: PType) =
of tyRef:
lineCg(p, cpsStmts, visitorFrmt, [accessor, c.visitorFrmt])
of tySequence:
if tfHasAsgn notin typ.flags:
if optSeqDestructors notin c.p.module.config.globalOptions:
lineCg(p, cpsStmts, visitorFrmt, [accessor, c.visitorFrmt])
elif containsGarbageCollectedRef(typ.lastSon):
# destructor based seqs are themselves not traced but their data is, if
Expand Down
18 changes: 18 additions & 0 deletions tests/destructor/tatomicptrs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,21 @@ proc newMySeq*[T](size: int, initial_value: T): MySeq[T] =

let x = makeShared(newMySeq(10, 1.0))
doAssert: x.get().len == 10



#-------------------------------------------------------
#bug #12882

type
ValueObject = object
v: MySeq[int]
name: string

TopObject = object
internal: seq[ValueObject]

var zz = new(TopObject)



0 comments on commit 1e1fd73

Please sign in to comment.