diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-06-16 17:13:34 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-06-16 17:13:34 +0000 |
commit | a6135b896a99613d340fccfce5b75c3ee877b951 (patch) | |
tree | a787782bbdf54370a295ec8cc411fa7005308b66 /libstdc++-v3/testsuite/23_containers/unordered_set | |
parent | 57db98e1a3c83df78f4a5a877ddef55bb046d6fd (diff) | |
download | gcc-a6135b896a99613d340fccfce5b75c3ee877b951.tar.gz |
PR libstdc++/57263
* include/bits/forward_list.h (_Fwd_list_base): Convert to/from
allocator's pointer type.
* include/bits/hashtable.h (_Hashtable): Likewise.
* testsuite/util/testsuite_allocator.h (CustomPointerAlloc): Add.
* testsuite/23_containers/forward_list/allocator/ext_ptr.cc: New.
* testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: New.
* testsuite/23_containers/vector/allocator/ext_ptr.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200136 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/unordered_set')
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/unordered_set/allocator/ext_ptr.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/ext_ptr.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/ext_ptr.cc new file mode 100644 index 00000000000..55d9af3a5cb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/ext_ptr.cc @@ -0,0 +1,48 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <unordered_set> +#include <memory> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +struct T { int i; }; +bool operator==(const T& l, const T& r) { return l.i == r.i; } +struct H { std::size_t operator()(const T& t) const noexcept { return t.i; } +}; +struct E : std::equal_to<T> { }; + +using __gnu_test::CustomPointerAlloc; + +template class std::unordered_set<T, H, E, CustomPointerAlloc<T>>; + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef CustomPointerAlloc<T> alloc_type; + typedef std::unordered_set<T, H, E, alloc_type> test_type; + test_type v; + v.insert(T()); + VERIFY( ++v.begin() == v.end() ); +} + +int main() +{ + test01(); +} |