From patchwork Sun Feb 19 17:19:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 142065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 996E4B6EF3 for ; Mon, 20 Feb 2012 04:21:53 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1330276916; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=vRke6Idy0CBGJhPhhkVDERCvCIs=; b=PGkTxEqK/8xMop/ sWKVrIC8RWU3LLMgEyb4u6Oq+cHnhOVZeUSQQP37Fb+hxlgdbXucTsRSvXCw8ohv Di5swVZXhxfHAMonMiCvV67XXf4W8hFDg8bieUMXm+MvOZIhEAg6aWfymjYdkuWy IIKVe2VIxFImB6p8u0VUGVjGuhag= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=vbTThoN/bt3gZF3Meo7bF/b6ySv8TZd9KkR0t+OkQGDnqujnPwFjk8OAGS2LP9 /VT6pd/VNrR8XHMkUPlA1RsqPztfV85Qdy2t+zLcbhR5okE/z5h1DsSgxU88EqQK W55OwwvvVusXcoW8G28+ba7mMWkKdjg56BwRF3EaxxbyU=; Received: (qmail 6227 invoked by alias); 19 Feb 2012 17:21:49 -0000 Received: (qmail 6210 invoked by uid 22791); 19 Feb 2012 17:21:48 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 19 Feb 2012 17:21:35 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q1JHLYSx015268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 19 Feb 2012 17:21:35 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q1JHLXX4009736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 19 Feb 2012 17:21:33 GMT Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q1JHLXY2029448; Sun, 19 Feb 2012 11:21:33 -0600 Received: from [192.168.1.4] (/79.51.12.82) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 19 Feb 2012 09:21:33 -0800 Message-ID: <4F412F21.5040807@oracle.com> Date: Sun, 19 Feb 2012 18:19:29 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120208 Thunderbird/10.0.1 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] libstdc++/52309 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, this is what I'm going to apply. Seems straightforward enough to go in now. Tested x86_64-linux. Thanks, Paolo. /////////////////// 2012-02-19 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. Index: include/bits/hashtable_policy.h =================================================================== --- include/bits/hashtable_policy.h (revision 184380) +++ include/bits/hashtable_policy.h (working copy) @@ -1113,7 +1113,7 @@ 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() || !(*__ity == *__itx)) return false; } return true; Index: testsuite/23_containers/unordered_set/operators/52309.cc =================================================================== --- testsuite/23_containers/unordered_set/operators/52309.cc (revision 0) +++ testsuite/23_containers/unordered_set/operators/52309.cc (revision 0) @@ -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);