Skip to content

Commit

Permalink
fix #19862; make widestrs consistent between refc and orc (#19874) [b…
Browse files Browse the repository at this point in the history
…ackport]

fix #19862; make widestrs consistent in refc and orc
  • Loading branch information
ringabout authored Jun 9, 2022
1 parent 25d8926 commit 1972005
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/system/widestrs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,6 @@ when defined(nimv2):

proc `$`*(s: WideCStringObj): string =
$(s.data)

proc len*(w: WideCStringObj): int {.inline.} =
len(w.data)
13 changes: 13 additions & 0 deletions tests/arc/t19862.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
discard """
matrix: "--gc:refc; --gc:arc"
"""

# bug #19862
type NewString = object

proc len(s: NewString): int = 10

converter toNewString(x: WideCStringObj): NewString = discard

let w = newWideCString("test")
doAssert len(w) == 4

0 comments on commit 1972005

Please sign in to comment.