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
This commit is contained in:
Paolo Carlini 2012-02-20 11:11:39 +00:00 committed by Paolo Carlini
parent c578750f9c
commit d150390867
3 changed files with 38 additions and 3 deletions

View File

@ -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

View File

@ -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.

View File

@ -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);