You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeSmartPtr=object
o: intprocnewId(): int=var g {.global.} =0inc g
echo"new ", g
g
proc`=destroy`*(o: varSmartPtr) =if o.o !=0:
echo"destroy ", o.o
o.o =0proc`=copy`*(a: varSmartPtr, b: SmartPtr) =if a.o !=0:
echo"delete ", a.o
if b.o ==0:
a.o =0else:
a.o =newId()
procfoo(s: SmartPtr) =discardproctest() =var a =SmartPtr(o: newId())
foo(SmartPtr(o: newId()))
test()
Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2023-10-22
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: c13c48500b527cb483480702390b1f230ac896a4
active boot switches: -d:release
Current Output
new 1
new 2
destroy 1
Expected Output
Should contain destroy 2 somewhere.
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Description
Nim Version
Current Output
Expected Output
Should contain
destroy 2
somewhere.Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: