[libcxx] r307510 - Fix test failure to to new/delete ellisions

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 9 15:20:07 PDT 2017


Author: ericwf
Date: Sun Jul  9 15:20:07 2017
New Revision: 307510

URL: http://llvm.org/viewvc/llvm-project?rev=307510&view=rev
Log:
Fix test failure to to new/delete ellisions

Modified:
    libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp

Modified: libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp?rev=307510&r1=307509&r2=307510&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp Sun Jul  9 15:20:07 2017
@@ -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);




More information about the cfe-commits mailing list