Skip to content

Commit

Permalink
Merge pull request #5863 from jercaianu/allocbug
Browse files Browse the repository at this point in the history
Fix Issue 17986 - Erratic failure with std/experimental/allocator/common.d(445): unittest failure
  • Loading branch information
andralex committed Nov 17, 2017
2 parents ea1e9b2 + f529c85 commit a07e0ef
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions std/experimental/allocator/common.d
Expand Up @@ -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;
Expand All @@ -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);
}

/**
Expand Down

0 comments on commit a07e0ef

Please sign in to comment.