diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2012-02-20 11:11:39 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2012-02-20 11:11:39 +0000 |
commit | d150390867de8dc4c2405ffc764ada207e0fd48f (patch) | |
tree | a4197f7757f45f2a2b9d6f3a50e90ddb1911bb83 | |
parent | c578750f9cc7a6e3c214a5b7e580ac739762c732 (diff) | |
download | gcc-d150390867de8dc4c2405ffc764ada207e0fd48f.zip gcc-d150390867de8dc4c2405ffc764ada207e0fd48f.tar.gz gcc-d150390867de8dc4c2405ffc764ada207e0fd48f.tar.bz2 |
re PR libstdc++/52309 ([c++0x] unordered_set illegally requires value_type::operator!=)
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.
From-SVN: r184388
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/hashtable_policy.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/unordered_set/operators/52309.cc | 28 |
3 files changed, 38 insertions, 3 deletions
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 <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 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 +// <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); |