From f529c855ae3f2dfd66d1f1f0af9873c1bbc01f0a Mon Sep 17 00:00:00 2001 From: Alexandru Jercaianu Date: Fri, 17 Nov 2017 12:10:48 +0200 Subject: [PATCH] Fix Issue 17986 - Erratic failure with std/experimental/allocator/common.d(445): unittest failure --- std/experimental/allocator/common.d | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/std/experimental/allocator/common.d b/std/experimental/allocator/common.d index 4103df6d924..72698d53517 100644 --- a/std/experimental/allocator/common.d +++ b/std/experimental/allocator/common.d @@ -440,9 +440,10 @@ if (hasMember!(Allocator, "alignedAllocate")) assert(alignedReallocate(a1, b, b.length, alignment)); assert(!called); - // Ask for same length, different alignment, should call 'alignedAllocate' + // Ask for same length, different alignment + // should call 'alignedAllocate' if not aligned to new value alignedReallocate(a1, b, b.length, alignment + 1); - assert(called); + assert(b.ptr.alignedAt(alignment + 1) || called); called = false; DummyAllocatorExpand a2; @@ -451,9 +452,10 @@ if (hasMember!(Allocator, "alignedAllocate")) assert(called); called = false; - // Ask for bigger length, different alignment, should call 'alignedAllocate' + // Ask for bigger length, different alignment + // should call 'alignedAllocate' if not aligned to new value alignedReallocate(a2, b, b.length + 1, alignment + 1); - assert(!called); + assert(b.ptr.alignedAt(alignment + 1) || !called); } /**