diff options
| author | Eugen Wissner <belka@caraus.de> | 2019-08-28 20:50:15 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2019-08-28 20:50:15 +0200 |
| commit | c69282a8dfac4e0abfa544cbf13bad8819e2487c (patch) | |
| tree | 0b79dc4882ae6e5289482f0112289f087e1ffbe5 /source | |
| parent | 0a973b46ba399e238324620a6a0b117ec5e510b3 (diff) | |
| download | tanya-c69282a8dfac4e0abfa544cbf13bad8819e2487c.tar.gz | |
Work around 2.086 bugs
Diffstat (limited to 'source')
| -rw-r--r-- | source/tanya/container/array.d | 11 | ||||
| -rw-r--r-- | source/tanya/container/entry.d | 2 | ||||
| -rw-r--r-- | source/tanya/container/list.d | 10 |
3 files changed, 15 insertions, 8 deletions
diff --git a/source/tanya/container/array.d b/source/tanya/container/array.d index 872d55e..8e4a878 100644 --- a/source/tanya/container/array.d +++ b/source/tanya/container/array.d @@ -306,8 +306,13 @@ struct Array(T) */ ~this() { - clear(); - (() @trusted => allocator.deallocate(slice(capacity)))(); + destroyAll(slice(this.length_)); + deallocate(); + } + + private void deallocate() @trusted + { + allocator.deallocate(slice(capacity)); } static if (isCopyable!T) @@ -456,7 +461,7 @@ struct Array(T) destroy(*src); } } - allocator.deallocate(this.data[0 .. this.capacity_]); + deallocate(); this.data = cast(T*) buf; } this.capacity_ = size; diff --git a/source/tanya/container/entry.d b/source/tanya/container/entry.d index cc434b8..6fd23de 100644 --- a/source/tanya/container/entry.d +++ b/source/tanya/container/entry.d @@ -116,7 +116,7 @@ package static immutable size_t[33] primes = [ 805306457, 1610612741, 3221225473 ]; -package struct HashArray(alias hasher, K, V = void) +package(tanya.container) struct HashArray(alias hasher, K, V = void) { alias Key = K; alias Value = V; diff --git a/source/tanya/container/list.d b/source/tanya/container/list.d index 31ddfd5..20da47e 100644 --- a/source/tanya/container/list.d +++ b/source/tanya/container/list.d @@ -978,10 +978,12 @@ struct DList(T) // 0th and the last elements of the list. private Entry* head, tail; - invariant ((this.tail is null && this.head is null) - || (this.tail !is null && this.head !is null)); - invariant (this.tail is null || this.tail.next is null); - invariant (this.head is null || this.head.prev is null); + static if (__VERSION__ < 2086) // Bug #20171. + { + invariant ((this.tail is null) == (this.head is null)); + invariant (this.tail is null || this.tail.next is null); + invariant (this.head is null || this.head.prev is null); + } /** * Creates a new $(D_PSYMBOL DList) with the elements from a static array. |
