From patchwork Wed Feb 13 21:11:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Fran=C3=A7ois_Dumont?= X-Patchwork-Id: 220252 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 9191D2C0087 for ; Thu, 14 Feb 2013 08:11:45 +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=1361394706; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=oJMHaOBhUpVWui7eB/oDCGCwh9o=; b=xyk60ZcpSX9GDYO zcbL876Xxy8wzwlRDrxI2FMp3qmNpI+f+YE/6WiyBEV6EMMOmHcOJ1h7ana4m5j/ Bt7GQJjXBz8YlBfr6b71CD0kVyTyxe1tXds0U5lWauaO8Z5lfRwTvGE/EbqkSOBv o2Qjvq5S8CDqXH16Nw7a80nzq2Z8= 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:X-Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=x1mMZUhUP2+wk87mNhty6KKp1GGcUkVGuz4qtXPNOV1M1D4pgZHj32w0riuzNV cqCF80mxKKuAcNH5L8sNxGAZTMpBl0LSgaAbxqHDOfWhMSOYZ4Ec1CxEn1YbQxML 7UBnGkpAcBmUzuZVvf0TeDFM5TyvB1l4K09EoHRhrFE/E=; Received: (qmail 10120 invoked by alias); 13 Feb 2013 21:11:36 -0000 Received: (qmail 10096 invoked by uid 22791); 13 Feb 2013 21:11:35 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f178.google.com (HELO mail-we0-f178.google.com) (74.125.82.178) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Feb 2013 21:11:29 +0000 Received: by mail-we0-f178.google.com with SMTP id x48so1469896wey.9 for ; Wed, 13 Feb 2013 13:11:28 -0800 (PST) X-Received: by 10.180.106.34 with SMTP id gr2mr12746411wib.18.1360789887946; Wed, 13 Feb 2013 13:11:27 -0800 (PST) Received: from localhost.localdomain (arf62-1-82-237-250-248.fbx.proxad.net. [82.237.250.248]) by mx.google.com with ESMTPS id bj9sm16030421wib.4.2013.02.13.13.11.26 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Feb 2013 13:11:27 -0800 (PST) Message-ID: <511C017D.2090700@gmail.com> Date: Wed, 13 Feb 2013 22:11:25 +0100 From: =?ISO-8859-1?Q?Fran=E7ois_Dumont?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120829 Thunderbird/15.0 MIME-Version: 1.0 To: Jonathan Wakely CC: Paolo Carlini , libstdc++@gcc.gnu.org, gcc-patches Subject: Re: [patch] fix libstdc++/56278 References: <511AABED.3050805@gmail.com> <511B68AB.7070307@oracle.com> In-Reply-To: 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 Committed then. 2013-02-13 François Dumont * include/bits/hashtable_policy.h (_Hash_code_base): Restore default constructor protected. * include/bits/hashtable.h: static assert that _Hash_code_base has a default constructor available through inheritance. On 02/13/2013 12:36 PM, Jonathan Wakely wrote: > On 13 February 2013 10:19, Paolo Carlini wrote: >> On 02/12/2013 09:54 PM, François Dumont wrote: >>> Of course this is not mandatory but I think _Hash_code_base would be >>> cleaner this way only exposing as public what is required by C++11. It can >>> also wait for 4.9. >> I like it. Thanks Francois. If Jon has no objections over the next day or >> so, please go ahead. > No objection, I agree it's suitable for 4.8 as it's refining my > regression fix, but I don't think it really makes any difference. > There is nothing required by C++11 for _Hash_code_base's constructors > because it's an implementation detail, and the only way a user can > tell the difference between a public and protected constructor is > trying to construct _Hash_code_base directly, which is obviously > unsupported. > Index: include/bits/hashtable_policy.h =================================================================== --- include/bits/hashtable_policy.h (revision 195955) +++ include/bits/hashtable_policy.h (working copy) @@ -918,15 +918,13 @@ using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; using __ebo_hash = _Hashtable_ebo_helper<1, _Hash>; - public: - // We need the default constructor for the local iterators. - _Hash_code_base() = default; - protected: typedef void* __hash_code; typedef _Hash_node<_Value, false> __node_type; - protected: + // We need the default constructor for the local iterators. + _Hash_code_base() = default; + _Hash_code_base(const _ExtractKey& __ex, const _H1&, const _H2&, const _Hash& __h) : __ebo_extract_key(__ex), __ebo_hash(__h) { } @@ -1004,13 +1002,13 @@ hash_function() const { return _M_h1(); } - // We need the default constructor for the local iterators. - _Hash_code_base() = default; - protected: typedef std::size_t __hash_code; typedef _Hash_node<_Value, false> __node_type; + // We need the default constructor for the local iterators. + _Hash_code_base() = default; + _Hash_code_base(const _ExtractKey& __ex, const _H1& __h1, const _H2& __h2, const _Default_ranged_hash&) Index: include/bits/hashtable.h =================================================================== --- include/bits/hashtable.h (revision 195955) +++ include/bits/hashtable.h (working copy) @@ -266,7 +266,10 @@ // __hash_code_base above to compute node bucket index so it has to be // default constructible. static_assert(__if_hash_not_cached< - is_default_constructible<__hash_code_base>>::value, + is_default_constructible< + // We use _Hashtable_ebo_helper to access the protected + // default constructor. + __detail::_Hashtable_ebo_helper<0, __hash_code_base>>>::value, "Cache the hash code or make functors involved in hash code" " and bucket index computation default constructible");