From patchwork Mon Feb 11 00:21:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 219530 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 32CA62C007C for ; Mon, 11 Feb 2013 11:21:32 +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=1361146892; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Date:Message-ID:Subject:From:To: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=FcFuiFU gbN/gZJdhEWCjX8lkswE=; b=kuoiNBwospB9XDNscMsQrT2SFFHADUVF7XP35ir uU+T4fBp9MJpiRYvtzK4frX55ymIzbnozmj2jGQR0wdRxwSLKvkjPR+TXe3xNfZG U9r/RyF3brXGWa5wlI94h0E6lVIGBaD32Jzxibb3RuI0wwbj448kEJBabefWWGrB jojU= 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:MIME-Version:X-Received:Received:Date:Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=rUcKlWaKEDkvBtYZYIa2gfV686UVGA0g8NztslKfOOfBUq76wFUB1Jb2pbSjBc ySnIV9AQwZZ9XS7m6ZQ21R3TqjFwAe+m6m/ihZx+xJJJ3HTsafSq0uJnODB3YAi6 DL3Sm5udsPH1BvVi3R8AAYZUxQgOybPd1syaMOgxu4+Gk=; Received: (qmail 12259 invoked by alias); 11 Feb 2013 00:21:23 -0000 Received: (qmail 12244 invoked by uid 22791); 11 Feb 2013 00:21:21 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-lb0-f178.google.com (HELO mail-lb0-f178.google.com) (209.85.217.178) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Feb 2013 00:21:15 +0000 Received: by mail-lb0-f178.google.com with SMTP id n1so4300193lba.9 for ; Sun, 10 Feb 2013 16:21:13 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.152.108.195 with SMTP id hm3mr11305486lab.17.1360542073367; Sun, 10 Feb 2013 16:21:13 -0800 (PST) Received: by 10.112.31.169 with HTTP; Sun, 10 Feb 2013 16:21:13 -0800 (PST) Date: Mon, 11 Feb 2013 00:21:13 +0000 Message-ID: Subject: [patch] fix libstdc++/56278 From: Jonathan Wakely To: "libstdc++" , gcc-patches 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 PR libstdc++/56278 * include/bits/hashtable_policy.h (_Hash_code_base): Make default constructor public. * testsuite/23_containers/unordered_set/56278.cc: New. Tested x86_64-linux, committed to trunk. commit b893384109ddb4dfc1afac24dc6b2c56557f2fa8 Author: Jonathan Wakely Date: Sun Feb 10 22:08:34 2013 +0000 PR libstdc++/56278 * include/bits/hashtable_policy.h (_Hash_code_base): Make default constructor public. * testsuite/23_containers/unordered_set/56278.cc: New. diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index f4d8dc0..a88b32e 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -918,13 +918,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 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; - // We need the default constructor for the local iterators. - _Hash_code_base() = default; - + protected: _Hash_code_base(const _ExtractKey& __ex, const _H1&, const _H2&, const _Hash& __h) : __ebo_extract_key(__ex), __ebo_hash(__h) { } @@ -956,7 +958,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::swap(_M_ranged_hash(), __x._M_ranged_hash()); } - protected: const _ExtractKey& _M_extract() const { return __ebo_extract_key::_S_cget(*this); } @@ -1003,13 +1004,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 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&) diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/56278.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/56278.cc new file mode 100644 index 0000000..c73a524 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/56278.cc @@ -0,0 +1,30 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2013 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 +// . + +// libstdc++/56278 + +#include + +struct hash : std::hash +{ + hash() { } +}; + +std::unordered_set::local_iterator i;