Fix test failure to to new/delete ellisions

llvm-svn: 307510
This commit is contained in:
Eric Fiselier 2017-07-09 22:20:07 +00:00
parent 4eac9f0545
commit 52f2683695
1 changed files with 3 additions and 2 deletions

View File

@ -29,11 +29,12 @@ struct A
int main()
{
globalMemCounter.reset();
std::allocator<A> a;
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(A_constructed == 0);
globalMemCounter.last_new_size = 0;
A* ap = a.allocate(3);
A* volatile ap = a.allocate(3);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int)));
assert(A_constructed == 0);
@ -42,7 +43,7 @@ int main()
assert(A_constructed == 0);
globalMemCounter.last_new_size = 0;
A* ap2 = a.allocate(3, (const void*)5);
A* volatile ap2 = a.allocate(3, (const void*)5);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int)));
assert(A_constructed == 0);