From 26e4f63c575b20e828101bf04510b5383d2a0b97 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Wed, 10 Jul 2019 20:17:05 +0300 Subject: [PATCH] Fix a strange build issue, manifesting only in certain contexts --- faststreams/output_stream.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/faststreams/output_stream.nim b/faststreams/output_stream.nim index f98e20d..2f11af0 100644 --- a/faststreams/output_stream.nim +++ b/faststreams/output_stream.nim @@ -7,7 +7,7 @@ type startOffset: int OutputStream* = object of RootObj - cursor: WriteCursor + cursor*: WriteCursor pages: Deque[OutputPage] endPos: int vtable*: ptr OutputStreamVTable @@ -285,7 +285,8 @@ proc append*(c: var WriteCursor, chars: openarray[char]) {.inline.} = template appendMemCopy*(c: var WriteCursor, value: auto) = bind append # TODO: add a check that this is a trivial type - c.append makeOpenArray(cast[ptr byte](unsafeAddr(value)), sizeof(value)) + let valueAddr = unsafeAddr value + c.append makeOpenArray(cast[ptr byte](valueAddr), sizeof(value)) template append*(c: var WriteCursor, str: string) = bind append