summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/function.objects
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-03-18 22:56:50 +0000
committerEric Fiselier <eric@efcs.ca>2015-03-18 22:56:50 +0000
commit6d370568c3239568f9ba375f521ea84315abace7 (patch)
tree373f4b4c1911f7d6587e75f354ee729e13c0a685 /libcxx/test/std/utilities/function.objects
parentcf1d7df2e30f3b2469308ca37b65e73e4be352e7 (diff)
downloadbcm5719-llvm-6d370568c3239568f9ba375f521ea84315abace7.tar.gz
bcm5719-llvm-6d370568c3239568f9ba375f521ea84315abace7.zip
[libc++] Fix PR22922 - Allocator support for std::function does not know how to rebind.
Summary: This patch changes std::function to use allocator_traits to rebind the allocator instead of allocator itself. It also changes most of the tests to use `bare_allocator` where possible instead of `test_allocator`. Reviewers: mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8391 llvm-svn: 232686
Diffstat (limited to 'libcxx/test/std/utilities/function.objects')
-rw-r--r--libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp12
-rw-r--r--libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp7
-rw-r--r--libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp4
5 files changed, 18 insertions, 15 deletions
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
index 4feac30c300..f97e34d3f2c 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
@@ -16,10 +16,12 @@
#include <functional>
#include <cassert>
-#include "test_allocator.h"
+#include "min_allocator.h"
int main()
{
- std::function<int(int)> f(std::allocator_arg, test_allocator<int>());
+ {
+ std::function<int(int)> f(std::allocator_arg, bare_allocator<int>());
assert(!f);
+ }
}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
index 28e44a67a71..741a3b9a955 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
@@ -16,7 +16,7 @@
#include <functional>
#include <cassert>
-#include "test_allocator.h"
+#include "min_allocator.h"
class A
{
@@ -57,19 +57,19 @@ public:
int main()
{
{
- std::function<int(int)> f(std::allocator_arg, test_allocator<A>(), A());
+ std::function<int(int)> f(std::allocator_arg, bare_allocator<A>(), A());
assert(A::count == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
{
- std::function<int(int)> f(std::allocator_arg, test_allocator<int(*)(int)>(), g);
+ std::function<int(int)> f(std::allocator_arg, bare_allocator<int(*)(int)>(), g);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
}
{
- std::function<int(int)> f(std::allocator_arg, test_allocator<int(*)(int)>(),
+ std::function<int(int)> f(std::allocator_arg, bare_allocator<int(*)(int)>(),
(int (*)(int))0);
assert(!f);
assert(f.target<int(*)(int)>() == 0);
@@ -77,7 +77,7 @@ int main()
}
{
std::function<int(const A*, int)> f(std::allocator_arg,
- test_allocator<int(A::*)(int)const>(),
+ bare_allocator<int(A::*)(int)const>(),
&A::foo);
assert(f);
assert(f.target<int (A::*)(int) const>() != 0);
@@ -91,7 +91,7 @@ int main()
#endif
{
std::function<void(int)> fun(std::allocator_arg,
- test_allocator<int(*)(int)>(),
+ bare_allocator<int(*)(int)>(),
&g);
assert(fun);
assert(fun.target<int(*)(int)>() != 0);
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
index bb8feff7a16..e89636a69d6 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
@@ -17,6 +17,7 @@
#include <functional>
#include <cassert>
+#include "min_allocator.h"
#include "test_allocator.h"
#include "count_new.hpp"
@@ -58,7 +59,7 @@ int main()
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
- std::function<int(int)> f2(std::allocator_arg, test_allocator<A>(), f);
+ std::function<int(int)> f2(std::allocator_arg, bare_allocator<A>(), f);
assert(A::count == 2);
assert(globalMemCounter.checkOutstandingNewEq(2));
assert(f2.target<A>());
@@ -71,7 +72,7 @@ int main()
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
- std::function<int(int)> f2(std::allocator_arg, test_allocator<int(*)(int)>(), f);
+ std::function<int(int)> f2(std::allocator_arg, bare_allocator<int(*)(int)>(), f);
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(f2.target<int(*)(int)>());
assert(f2.target<A>() == 0);
@@ -91,7 +92,7 @@ int main()
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(f.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
- std::function<int(int)> f2(std::allocator_arg, test_allocator<int>(), f);
+ std::function<int(int)> f2(std::allocator_arg, bare_allocator<int>(), f);
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(f2.target<int(*)(int)>() == 0);
assert(f2.target<A>() == 0);
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
index 956136be021..2350f92f0f8 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
@@ -16,10 +16,10 @@
#include <functional>
#include <cassert>
-#include "test_allocator.h"
+#include "min_allocator.h"
int main()
{
- std::function<int(int)> f(std::allocator_arg, test_allocator<int>(), nullptr);
+ std::function<int(int)> f(std::allocator_arg, bare_allocator<int>(), nullptr);
assert(!f);
}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
index 15b7c8b5aa4..aa6b743b523 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
@@ -16,7 +16,7 @@
#include <functional>
#include <cassert>
-#include "test_allocator.h"
+#include "min_allocator.h"
#include "count_new.hpp"
class A
@@ -56,7 +56,7 @@ int main()
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
- std::function<int(int)> f2(std::allocator_arg, test_allocator<A>(), std::move(f));
+ std::function<int(int)> f2(std::allocator_arg, bare_allocator<A>(), std::move(f));
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f2.target<A>());
OpenPOWER on IntegriCloud