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
typeSimpleType[T] =object
value: int# dummyField: TprocinitSimpleType[T](value: int): SimpleType[T] =doAssert value >=0echo"created "&$SimpleType[T] &" with value "&$value
result=SimpleType[T](value: value)
proc`=wasMoved`[T](x: varSimpleType[T]) =
x.value =-1proc`=destroy`[T](x: SimpleType[T]) =if x.value >=0:
echo"destroyed "&$SimpleType[T] &" with value "&$x.value
typeComposite=object
a: SimpleType[int]
b: SimpleType[float]
typeAnotherComposite=object
c: SimpleType[string]
d: SimpleType[byte]
block:
let x =Composite(a: initSimpleType[int](1), b: initSimpleType[float](2))
block:
let x =AnotherComposite(c: initSimpleType[string](3), d: initSimpleType[byte](4))
Nim Version
Nim Compiler Version 2.2.0 [Linux: amd64]
Compiled at 2024-10-02
Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 78983f1876726a49c69d65629ab433ea1310ece1
active boot switches: -d:release
Nim Compiler Version 2.2.1 [Linux: amd64]
Compiled at 2024-10-27
Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 24aa92c14f2301d1ef63f59bc4ae2ec31a64f9c5
active boot switches: -d:release
Current Output
created SimpleType[system.int] with value 1
created SimpleType[system.float] with value 2
destroyed SimpleType[system.int] with value 1
destroyed SimpleType[system.int] with value 2
created SimpleType[system.string] with value 3
created SimpleType[system.byte] with value 4
destroyed SimpleType[system.int] with value 3
destroyed SimpleType[system.int] with value 4
Expected Output
created SimpleType[system.int] with value 1
created SimpleType[system.float] with value 2
destroyed SimpleType[system.int] with value 1
destroyed SimpleType[system.float] with value 2
created SimpleType[system.string] with value 3
created SimpleType[system.byte] with value 4
destroyed SimpleType[system.string] with value 3
destroyed SimpleType[system.byte] with value 4
Known Workarounds
The problem disappears if the field dummyField: T is uncommented.
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Description
Here is a toy example:
Nim Version
Current Output
Expected Output
Known Workarounds
The problem disappears if the field
dummyField: T
is uncommented.Additional Information
No response
The text was updated successfully, but these errors were encountered: