This commit is contained in:
Araq
2018-08-29 15:46:50 +02:00
parent 8e33667262
commit e98e214422
2 changed files with 38 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
# bug #7854
type
Stream* = ref StreamObj
StreamObj* = object of RootObj
InhStream* = ref InhStreamObj
InhStreamObj* = object of Stream
f: string
proc newInhStream*(f: string): InhStream =
new(result)
result.f = f
var val: int
let str = newInhStream("input_file.json")
block:
# works:
proc load[T](data: var T, s: Stream) =
discard
load(val, str)
block:
# works
proc load[T](s: Stream, data: T) =
discard
load(str, val)
block:
# broken
proc load[T](s: Stream, data: var T) =
discard
load(str, val)