From patchwork Sun Jan 23 22:50:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 50373 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 27FD43858419 for ; Sun, 23 Jan 2022 22:52:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 27FD43858419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1642978340; bh=pe/t5z95GSOPueNgnwkfq219LsZy9LIxt4AtmHZZAgs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QZGreXF5mAnlEUOBWbsMgweZ6ybWgnsY60n1/Kbuyeye/DIMDBLLfXZu6WzTn9YQG ftWAOc1H6XjSf5fbLlgT5VIQFZmYZbqOLBVZO6WZzZgZYPrIHRbizbP8LMjkViRmH3 LSNC07DQGg62GchNd04s6BbE+M2wGF4n1qnjoXzI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E59513858414 for ; Sun, 23 Jan 2022 22:50:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E59513858414 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-502-bqSo3so3OwaKkZJyZfCwgw-1; Sun, 23 Jan 2022 17:50:08 -0500 X-MC-Unique: bqSo3so3OwaKkZJyZfCwgw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E1521083F61; Sun, 23 Jan 2022 22:50:07 +0000 (UTC) Received: from localhost (unknown [10.33.36.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A83D4DC1C; Sun, 23 Jan 2022 22:50:06 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Restore support for unordered_map [PR104174] Date: Sun, 23 Jan 2022 22:50:06 +0000 Message-Id: <20220123225006.641850-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, URI_HEX autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested powerpc64le-linux, pushed to trunk. I broke this unintentionally in r12-4259. libstdc++-v3/ChangeLog: PR libstdc++/104174 * include/bits/hashtable_policy.h (_Map_base): Add partial specialization for maps with const key types. * testsuite/23_containers/unordered_map/104174.cc: New test. --- libstdc++-v3/include/bits/hashtable_policy.h | 11 +++++++++++ .../testsuite/23_containers/unordered_map/104174.cc | 4 ++++ 2 files changed, 15 insertions(+) create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_map/104174.cc diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index 3b60eb9ae72..0f0b0f9ea51 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -812,6 +812,17 @@ namespace __detail return __pos->second; } + // Partial specialization for unordered_map, see PR 104174. + template + struct _Map_base, + _Alloc, _Select1st, _Equal, _Hash, + _RangeHash, _Unused, _RehashPolicy, _Traits, __uniq> + : _Map_base<_Key, pair, _Alloc, _Select1st, _Equal, _Hash, + _RangeHash, _Unused, _RehashPolicy, _Traits, __uniq> + { }; + /** * Primary class template _Insert_base. * diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/104174.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/104174.cc new file mode 100644 index 00000000000..4007425bf74 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/104174.cc @@ -0,0 +1,4 @@ +// { dg-do compile { target c++11 } } +// PR libstdc++/104174 unordered_map fails +#include +std::unordered_map> m;