parent
fb32fff8dc
commit
53c898de41
2 changed files with 30 additions and 1 deletions
|
|
@ -84,7 +84,7 @@ proc repr*(p: pointer): string =
|
||||||
|
|
||||||
proc repr*(p: proc): string =
|
proc repr*(p: proc): string =
|
||||||
## repr of a proc as its address
|
## repr of a proc as its address
|
||||||
repr(cast[pointer](p))
|
repr(cast[ptr pointer](unsafeAddr p)[])
|
||||||
|
|
||||||
template repr*(x: distinct): string =
|
template repr*(x: distinct): string =
|
||||||
repr(distinctBase(typeof(x))(x))
|
repr(distinctBase(typeof(x))(x))
|
||||||
|
|
|
||||||
29
tests/arc/t17812.nim
Normal file
29
tests/arc/t17812.nim
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
discard """
|
||||||
|
targets: "c js"
|
||||||
|
matrix: "--gc:refc; --gc:arc"
|
||||||
|
"""
|
||||||
|
|
||||||
|
import std/times
|
||||||
|
|
||||||
|
block: # bug #17812
|
||||||
|
block:
|
||||||
|
type
|
||||||
|
Task = object
|
||||||
|
cb: proc ()
|
||||||
|
|
||||||
|
proc hello() = discard
|
||||||
|
|
||||||
|
|
||||||
|
let t = Task(cb: hello)
|
||||||
|
|
||||||
|
doAssert t.repr.len > 0
|
||||||
|
|
||||||
|
|
||||||
|
block:
|
||||||
|
type MyObj = object
|
||||||
|
field: DateTime
|
||||||
|
|
||||||
|
|
||||||
|
proc `$`(o: MyObj): string = o.repr
|
||||||
|
|
||||||
|
doAssert ($MyObj()).len > 0
|
||||||
Loading…
Add table
Add a link
Reference in a new issue