summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-11-05 21:00:49 +0800
committerGitHub <noreply@github.com>2020-11-05 14:00:49 +0100
commit8e1fa84b0d44bc6fb995992becf659d62b36713a (patch)
treedf2d3cbb21d0103dff231197bc9d4ee8e18420ea
parenta8af664e8ba8672e736c72971a18c0e00ba9b086 (diff)
downloadNim-8e1fa84b0d44bc6fb995992becf659d62b36713a.tar.gz
fix #15663 (#15839) [backport:1.4]
-rw-r--r--lib/system/widestrs.nim7
-rw-r--r--tests/stdlib/t15663.nim7
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/system/widestrs.nim b/lib/system/widestrs.nim
index 6d54bce9b..955fab46a 100644
--- a/lib/system/widestrs.nim
+++ b/lib/system/widestrs.nim
@@ -214,3 +214,10 @@ proc `$`*(w: WideCString, estimate: int, replacement: int = 0xFFFD): string =
 
 proc `$`*(s: WideCString): string =
   result = s $ 80
+
+when defined(nimv2):
+  proc `$`*(s: WideCStringObj, estimate: int, replacement: int = 0xFFFD): string =
+    `$`(s.data, estimate, replacement)
+
+  proc `$`*(s: WideCStringObj): string =
+    $(s.data)
diff --git a/tests/stdlib/t15663.nim b/tests/stdlib/t15663.nim
new file mode 100644
index 000000000..1ad5677fd
--- /dev/null
+++ b/tests/stdlib/t15663.nim
@@ -0,0 +1,7 @@
+discard """
+  cmd: "nim c --gc:arc $file"
+  output: "Test"
+"""
+
+let ws = newWideCString("Test")
+echo ws
\ No newline at end of file