From 52f2683695cf26bdf18f2b3d84292a11cbbe938a Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 9 Jul 2017 22:20:07 +0000 Subject: [PATCH] Fix test failure to to new/delete ellisions llvm-svn: 307510 --- .../memory/default.allocator/allocator.members/allocate.pass.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp index 253515e..f2cf9f2 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp @@ -29,11 +29,12 @@ struct A int main() { + globalMemCounter.reset(); std::allocator 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); -- 2.7.4