Bug #19473. If you pass an allocator to std::function, we should use that allocator, not construct one from scratch. Add a test to make sure

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@206623 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2014-04-18 17:23:36 +00:00
parent f1d10875d7
commit a178c13419
3 changed files with 80 additions and 10 deletions

View File

@@ -92,6 +92,15 @@ int main()
}
assert(new_called == 0);
{
assert(new_called == 0);
non_default_test_allocator<std::function<int(int)>> al(1);
std::function<int(int)> f2(std::allocator_arg, al, g);
assert(new_called == 0);
assert(f2.target<int(*)(int)>());
assert(f2.target<A>() == 0);
}
assert(new_called == 0);
{
std::function<int(int)> f;
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);