Index: include/functional =================================================================== --- include/functional +++ include/functional @@ -1367,7 +1367,14 @@ __base<_Rp(_ArgTypes...)>* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const { - typedef typename _Alloc::template rebind<__func>::other _Ap; + typedef allocator_traits<_Alloc> __alloc_traits; + typedef typename __alloc_traits::template +#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES + rebind_alloc<__func> +#else + rebind_alloc<__func>::other +#endif + _Ap; _Ap __a(__f_.second()); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); @@ -1393,7 +1400,14 @@ void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT { - typedef typename _Alloc::template rebind<__func>::other _Ap; + typedef allocator_traits<_Alloc> __alloc_traits; + typedef typename __alloc_traits::template +#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES + rebind_alloc<__func> +#else + rebind_alloc<__func>::other +#endif + _Ap; _Ap __a(__f_.second()); __f_.~__compressed_pair<_Fp, _Alloc>(); __a.deallocate(this, 1); Index: test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp =================================================================== --- test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp +++ test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp @@ -16,10 +16,12 @@ #include #include -#include "test_allocator.h" +#include "min_allocator.h" int main() { - std::function f(std::allocator_arg, test_allocator()); + { + std::function f(std::allocator_arg, bare_allocator()); assert(!f); + } } Index: test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp =================================================================== --- test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp +++ test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp @@ -16,7 +16,7 @@ #include #include -#include "test_allocator.h" +#include "min_allocator.h" class A { @@ -57,19 +57,19 @@ int main() { { - std::function f(std::allocator_arg, test_allocator(), A()); + std::function f(std::allocator_arg, bare_allocator(), A()); assert(A::count == 1); assert(f.target()); assert(f.target() == 0); } assert(A::count == 0); { - std::function f(std::allocator_arg, test_allocator(), g); + std::function f(std::allocator_arg, bare_allocator(), g); assert(f.target()); assert(f.target() == 0); } { - std::function f(std::allocator_arg, test_allocator(), + std::function f(std::allocator_arg, bare_allocator(), (int (*)(int))0); assert(!f); assert(f.target() == 0); @@ -77,7 +77,7 @@ } { std::function f(std::allocator_arg, - test_allocator(), + bare_allocator(), &A::foo); assert(f); assert(f.target() != 0); @@ -91,7 +91,7 @@ #endif { std::function fun(std::allocator_arg, - test_allocator(), + bare_allocator(), &g); assert(fun); assert(fun.target() != 0); Index: test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp =================================================================== --- test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp +++ test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp @@ -17,6 +17,7 @@ #include #include +#include "min_allocator.h" #include "test_allocator.h" #include "count_new.hpp" @@ -58,7 +59,7 @@ assert(globalMemCounter.checkOutstandingNewEq(1)); assert(f.target()); assert(f.target() == 0); - std::function f2(std::allocator_arg, test_allocator(), f); + std::function f2(std::allocator_arg, bare_allocator(), f); assert(A::count == 2); assert(globalMemCounter.checkOutstandingNewEq(2)); assert(f2.target()); @@ -71,7 +72,7 @@ assert(globalMemCounter.checkOutstandingNewEq(0)); assert(f.target()); assert(f.target() == 0); - std::function f2(std::allocator_arg, test_allocator(), f); + std::function f2(std::allocator_arg, bare_allocator(), f); assert(globalMemCounter.checkOutstandingNewEq(0)); assert(f2.target()); assert(f2.target() == 0); @@ -91,7 +92,7 @@ assert(globalMemCounter.checkOutstandingNewEq(0)); assert(f.target() == 0); assert(f.target() == 0); - std::function f2(std::allocator_arg, test_allocator(), f); + std::function f2(std::allocator_arg, bare_allocator(), f); assert(globalMemCounter.checkOutstandingNewEq(0)); assert(f2.target() == 0); assert(f2.target() == 0); Index: test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp =================================================================== --- test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp +++ test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp @@ -16,10 +16,10 @@ #include #include -#include "test_allocator.h" +#include "min_allocator.h" int main() { - std::function f(std::allocator_arg, test_allocator(), nullptr); + std::function f(std::allocator_arg, bare_allocator(), nullptr); assert(!f); } Index: test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp =================================================================== --- test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp +++ test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp @@ -16,7 +16,7 @@ #include #include -#include "test_allocator.h" +#include "min_allocator.h" #include "count_new.hpp" class A @@ -56,7 +56,7 @@ assert(globalMemCounter.checkOutstandingNewEq(1)); assert(f.target()); assert(f.target() == 0); - std::function f2(std::allocator_arg, test_allocator(), std::move(f)); + std::function f2(std::allocator_arg, bare_allocator(), std::move(f)); assert(A::count == 1); assert(globalMemCounter.checkOutstandingNewEq(1)); assert(f2.target());