diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2014-01-20 15:49:39 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2014-01-20 15:49:39 +0000 |
commit | a2b0a9df465ccddec756a91aeb9391915b12b48e (patch) | |
tree | fc11c1e5cd8a03a58439ed2e28082fd5ee493633 /libstdc++-v3/testsuite | |
parent | 58048442861a5790f9c5439bfbb1e1e26a325691 (diff) |
PR libstdc++/56267
* include/bits/hashtable_policy.h (_Hash_code_base<... false>): Grant
friendship to _Local_iterator_base<..., false>.
(_Local_iterator_base): Give protected access to all existing members.
(_Local_iterator_base::_M_curr()): New public accessor.
(_Local_iterator_base::_M_get_bucket()): New public accessor.
(_Local_iterator_base<..., false>::_M_init()): New function to manage
the lifetime of the _Hash_code_base explicitly.
(_Local_iterator_base<..., false>::_M_destroy()): Likewise.
(_Local_iterator_base<..., false>): Define copy constructor and copy
assignment operator that use new functions to manage _Hash_code_base.
(operator==(const _Local_iterator_base&, const _Local_iterator_base&),
operator==(const _Local_iterator_base&, const _Local_iterator_base&)):
Use public API for _Local_iterator_base.
* include/debug/safe_local_iterator.h (_Safe_local_iterator): Likewise.
* include/debug/unordered_map (__debug::unordered_map::erase(),
__debug::unordered_multimap::erase()): Likewise.
* include/debug/unordered_set (__debug::unordered_set::erase(),
__debug::unordered_multiset::erase()): Likewise.
* testsuite/23_containers/unordered_set/56267-2.cc: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@206834 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/unordered_set/56267-2.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/56267-2.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/56267-2.cc new file mode 100644 index 00000000000..cae451a53f7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/56267-2.cc @@ -0,0 +1,43 @@ +// Copyright (C) 2014 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> + +struct audrey2hash : std::hash<int> +{ + audrey2hash() { throw "Seed me, Seymour"; } // must not use default ctor + + audrey2hash(int) { } + + audrey2hash& + operator=(const audrey2hash&) { throw "Don't assign the plants"; } +}; + +void test01() +{ + typedef std::unordered_set<int, audrey2hash> test_type; + test_type::local_iterator it __attribute__((unused)); + test_type c{ {1, 2, 3}, 3u, audrey2hash{1} }; + it = c.begin(0); +} + +int main() +{ + test01(); +} |