fix #17812 (repr fails to compile with ARC/ORC) (#17816)

This commit is contained in:
flywind 2021-04-22 14:08:56 +08:00 • committed by GitHub
commit 53c898de41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

29
tests/arc/t17812.nim Normal file
View 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