[libcxx-commits] [libcxx] r362861 - Fix some incorrect std::function tests

Eric Fiselier via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 7 17:45:45 PDT 2019


Author: ericwf
Date: Fri Jun  7 17:45:45 2019
New Revision: 362861

URL: http://llvm.org/viewvc/llvm-project?rev=362861&view=rev
Log:
Fix some incorrect std::function tests

Modified:
    libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp

Modified: libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp?rev=362861&r1=362860&r2=362861&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp Fri Jun  7 17:45:45 2019
@@ -64,7 +64,9 @@ void test_FreeFunction(AllocType& alloc)
     FuncType* target = &FreeFunction;
     assert(globalMemCounter.checkOutstandingNewEq(0));
     std::function<FuncType> f2(std::allocator_arg, alloc, target);
-    assert(globalMemCounter.checkOutstandingNewEq(0));
+    // The allocator may not fit in the small object buffer, if we allocated
+    // check it was done via the allocator.
+    assert(globalMemCounter.checkOutstandingNewEq(test_alloc_base::alloc_count));
     assert(f2.template target<FuncType*>());
     assert(*f2.template target<FuncType*>() == target);
     assert(f2.template target<FuncType>() == 0);
@@ -81,7 +83,7 @@ void test_MemFunClass(AllocType& alloc)
     TargetType target = &MemFunClass::foo;
     assert(globalMemCounter.checkOutstandingNewEq(0));
     std::function<FuncType> f2(std::allocator_arg, alloc, target);
-    assert(globalMemCounter.checkOutstandingNewEq(0));
+    assert(globalMemCounter.checkOutstandingNewEq(test_alloc_base::alloc_count));
     assert(f2.template target<TargetType>());
     assert(*f2.template target<TargetType>() == target);
     assert(f2.template target<FuncType*>() == 0);




More information about the libcxx-commits mailing list