Workaround for #5098

This commit is contained in:
Yuriy Glukhov 2016-12-05 23:44:55 +02:00
commit 4423da465a

View file

@ -116,16 +116,15 @@ template hasKeyOrPutImpl(enlarge) {.dirty.} =
maybeRehashPutImpl(enlarge) maybeRehashPutImpl(enlarge)
else: result = true else: result = true
proc default[T](t: typedesc[T]): T {.inline.} = discard template default[T](t: typedesc[T]): T =
var v: T
v
template delImpl() {.dirty.} = template delImpl() {.dirty.} =
var hc: Hash var hc: Hash
var i = rawGet(t, key, hc) var i = rawGet(t, key, hc)
let msk = maxHash(t) let msk = maxHash(t)
if i >= 0: if i >= 0:
t.data[i].hcode = 0
t.data[i].key = default(type(t.data[i].key))
t.data[i].val = default(type(t.data[i].val))
dec(t.counter) dec(t.counter)
block outer: block outer:
while true: # KnuthV3 Algo6.4R adapted for i=i+1 instead of i=i-1 while true: # KnuthV3 Algo6.4R adapted for i=i+1 instead of i=i-1