parent
779b4e307b
commit
3ceaf5c130
2 changed files with 31 additions and 1 deletions
|
|
@ -146,8 +146,8 @@ proc instantiateBody(c: PContext, n, params: PNode, result, orig: PSym) =
|
||||||
freshGenSyms(c, b, result, orig, symMap)
|
freshGenSyms(c, b, result, orig, symMap)
|
||||||
b = semProcBody(c, b)
|
b = semProcBody(c, b)
|
||||||
result.ast[bodyPos] = hloBody(c, b)
|
result.ast[bodyPos] = hloBody(c, b)
|
||||||
trackProc(c, result, result.ast[bodyPos])
|
|
||||||
excl(result.flags, sfForward)
|
excl(result.flags, sfForward)
|
||||||
|
trackProc(c, result, result.ast[bodyPos])
|
||||||
dec c.inGenericInst
|
dec c.inGenericInst
|
||||||
|
|
||||||
proc fixupInstantiatedSymbols(c: PContext, s: PSym) =
|
proc fixupInstantiatedSymbols(c: PContext, s: PSym) =
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ aaaaa
|
||||||
hello
|
hello
|
||||||
ok
|
ok
|
||||||
true
|
true
|
||||||
|
copying
|
||||||
|
123
|
||||||
closed
|
closed
|
||||||
destroying variable: 20
|
destroying variable: 20
|
||||||
destroying variable: 10
|
destroying variable: 10
|
||||||
|
|
@ -433,3 +435,31 @@ proc t17712 =
|
||||||
echo el != nil
|
echo el != nil
|
||||||
|
|
||||||
t17712()
|
t17712()
|
||||||
|
|
||||||
|
# bug #18030
|
||||||
|
|
||||||
|
type
|
||||||
|
Foo = object
|
||||||
|
n: int
|
||||||
|
|
||||||
|
proc `=copy`(dst: var Foo, src: Foo) =
|
||||||
|
echo "copying"
|
||||||
|
dst.n = src.n
|
||||||
|
|
||||||
|
proc `=sink`(dst: var Foo, src: Foo) =
|
||||||
|
echo "sinking"
|
||||||
|
dst.n = src.n
|
||||||
|
|
||||||
|
var a: Foo
|
||||||
|
|
||||||
|
proc putValue[T](n: T)
|
||||||
|
|
||||||
|
proc useForward =
|
||||||
|
putValue(123)
|
||||||
|
|
||||||
|
proc putValue[T](n: T) =
|
||||||
|
var b = Foo(n:n)
|
||||||
|
a = b
|
||||||
|
echo b.n
|
||||||
|
|
||||||
|
useForward()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue