This commit is contained in:
Andreas Rumpf 2020-01-14 12:57:20 +01:00 • committed by GitHub
commit 9fc04a555c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -336,7 +336,7 @@ proc genAssignment(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) =
else: else:
linefmt(p, cpsStmts, "$1 = $2;$n", [rdLoc(dest), rdLoc(src)]) linefmt(p, cpsStmts, "$1 = $2;$n", [rdLoc(dest), rdLoc(src)])
of tyArray: of tyArray:
if containsGarbageCollectedRef(dest.t): if containsGarbageCollectedRef(dest.t) and p.config.selectedGC notin {gcArc, gcOrc, gcHooks}:
genGenericAsgn(p, dest, src, flags) genGenericAsgn(p, dest, src, flags)
else: else:
linefmt(p, cpsStmts, linefmt(p, cpsStmts,

View file

@ -4,6 +4,8 @@ discard """
Success Success
@["a", "b", "c"] @["a", "b", "c"]
Hello Hello
1
2
0''' 0'''
cmd: '''nim c --gc:arc $file''' cmd: '''nim c --gc:arc $file'''
""" """
@ -126,4 +128,20 @@ proc bug13119 =
bug13119() bug13119()
# bug #13105
type
Result[T, E] = object
a: T
b: E
D = ref object
x: int
R = Result[D, int]
proc bug13105 =
for n in [R(b: 1), R(b: 2)]:
echo n.b
bug13105()
echo getOccupiedMem() - startMem echo getOccupiedMem() - startMem