summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h4
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/operators/52309.cc28
3 files changed, 38 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 34fd1410cd7..b301599de06 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,10 +1,17 @@
+2012-02-20 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/52309
+ * include/bits/hashtable_policy.h (_Equality_base<, true,>::
+ _M_equal(const _Hashtable&)): Compare values with operator==.
+ * testsuite/23_containers/unordered_set/operators/52309.cc: New.
+
2012-02-17 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/51798 continued.
* acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Grep for
__atomic_, not __sync.
* configure: Regenerated.
-
+
2012-02-17 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/47058
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index a06f6e316bc..b585d23a970 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -1113,7 +1113,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (auto __itx = __this->begin(); __itx != __this->end(); ++__itx)
{
const auto __ity = __other.find(_ExtractKey()(*__itx));
- if (__ity == __other.end() || *__ity != *__itx)
+ if (__ity == __other.end() || !bool(*__ity == *__itx))
return false;
}
return true;
@@ -1151,7 +1151,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (_Uiterator __it1 = __first1; __it1 != __last1; ++__it1)
{
_Uiterator __tmp = __first1;
- while (__tmp != __it1 && !(*__tmp == *__it1))
+ while (__tmp != __it1 && !bool(*__tmp == *__it1))
++__tmp;
// We've seen this one before.
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/operators/52309.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/operators/52309.cc
new file mode 100644
index 00000000000..5b16f0b3cd9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/operators/52309.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2012 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/>.
+
+#include <unordered_set>
+
+// libstdc++/52309
+struct value {};
+struct hash { std::size_t operator()(const value&) const; };
+bool operator==(value const&, value const&);
+std::unordered_set<value, hash> set;
+bool z = (set == set);