summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-11 00:19:14 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-11 00:19:14 +0000
commitbf827976a596e58450c48c78ea1b08fab8fd7f46 (patch)
treedd947662576f0f5cf62bcb27ce2a193ec6d27ba2
parent3831d49dba5ec08c1b78df05d9bdd67476fc71a9 (diff)
downloadppe42-gcc-bf827976a596e58450c48c78ea1b08fab8fd7f46.tar.gz
ppe42-gcc-bf827976a596e58450c48c78ea1b08fab8fd7f46.zip
PR libstdc++/56278
* include/bits/hashtable_policy.h (_Hash_code_base): Make default constructor public. * testsuite/23_containers/unordered_set/56278.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195935 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h15
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/56278.cc30
3 files changed, 45 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index eea0e659900..775ad99e213 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2013-02-10 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/56278
+ * include/bits/hashtable_policy.h (_Hash_code_base): Make default
+ constructor public.
+ * testsuite/23_containers/unordered_set/56278.cc: New.
+
2013-02-09 François Dumont <fdumont@gcc.gnu.org>
* include/tr1/bessel_function.tcc (__cyl_bessel_ij_series): Code
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index f4d8dc0fbe6..a88b32e6530 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -918,13 +918,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>;
using __ebo_hash = _Hashtable_ebo_helper<1, _Hash>;
+ public:
+ // We need the default constructor for the local iterators.
+ _Hash_code_base() = default;
+
protected:
typedef void* __hash_code;
typedef _Hash_node<_Value, false> __node_type;
- // We need the default constructor for the local iterators.
- _Hash_code_base() = default;
-
+ protected:
_Hash_code_base(const _ExtractKey& __ex, const _H1&, const _H2&,
const _Hash& __h)
: __ebo_extract_key(__ex), __ebo_hash(__h) { }
@@ -956,7 +958,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::swap(_M_ranged_hash(), __x._M_ranged_hash());
}
- protected:
const _ExtractKey&
_M_extract() const { return __ebo_extract_key::_S_cget(*this); }
@@ -1003,13 +1004,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
hash_function() const
{ return _M_h1(); }
+ // We need the default constructor for the local iterators.
+ _Hash_code_base() = default;
+
protected:
typedef std::size_t __hash_code;
typedef _Hash_node<_Value, false> __node_type;
- // We need the default constructor for the local iterators.
- _Hash_code_base() = default;
-
_Hash_code_base(const _ExtractKey& __ex,
const _H1& __h1, const _H2& __h2,
const _Default_ranged_hash&)
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/56278.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/56278.cc
new file mode 100644
index 00000000000..c73a52420e2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/56278.cc
@@ -0,0 +1,30 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 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/>.
+
+// libstdc++/56278
+
+#include <unordered_set>
+
+struct hash : std::hash<int>
+{
+ hash() { }
+};
+
+std::unordered_set<int, hash>::local_iterator i;
OpenPOWER on IntegriCloud