From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 99E00385842C; Sun, 23 Jan 2022 22:49:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99E00385842C MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-6827] libstdc++: Restore support for unordered_map [PR104174] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 2d8a9ad4a922e3248d0f6c60a6331be6f47dc435 X-Git-Newrev: 084680db9af077ca37c5523a58b6c11e090e7335 Message-Id: <20220123224943.99E00385842C@sourceware.org> Date: Sun, 23 Jan 2022 22:49:43 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jan 2022 22:49:43 -0000 https://gcc.gnu.org/g:084680db9af077ca37c5523a58b6c11e090e7335 commit r12-6827-g084680db9af077ca37c5523a58b6c11e090e7335 Author: Jonathan Wakely Date: Sat Jan 22 00:35:45 2022 +0000 libstdc++: Restore support for unordered_map [PR104174] 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. Diff: --- libstdc++-v3/include/bits/hashtable_policy.h | 11 +++++++++++ libstdc++-v3/testsuite/23_containers/unordered_map/104174.cc | 4 ++++ 2 files changed, 15 insertions(+) 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;