From eeff6a54fe4eef656054dfb2053e1d4b006720ac Mon Sep 17 00:00:00 2001 From: paolo Date: Mon, 20 Feb 2012 11:11:39 +0000 Subject: [PATCH] 2012-02-20 Paolo Carlini 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184388 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 ++++++- libstdc++-v3/include/bits/hashtable_policy.h | 4 ++-- .../23_containers/unordered_set/operators/52309.cc | 28 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_set/operators/52309.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 34fd141..b301599 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,10 +1,17 @@ +2012-02-20 Paolo Carlini + + 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 PR libstdc++/51798 continued. * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Grep for __atomic_, not __sync. * configure: Regenerated. - + 2012-02-17 Benjamin Kosnik PR libstdc++/47058 diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index a06f6e3..b585d23 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 0000000..5b16f0b --- /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 +// . + +#include + +// libstdc++/52309 +struct value {}; +struct hash { std::size_t operator()(const value&) const; }; +bool operator==(value const&, value const&); +std::unordered_set set; +bool z = (set == set); -- 2.7.4