]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix std::unordered_set::emplace optimization [PR117686]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 19 Nov 2024 23:38:19 +0000 (23:38 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 20 Nov 2024 06:44:43 +0000 (06:44 +0000)
commit4484945c538b26da6881f83f664235988e471d40
treea3eee771bec942a6bc21f4aecdcd7d5a20056070
parent7c7da1036509a988b9ca3492eb856081132b14b2
libstdc++: Fix std::unordered_set::emplace optimization [PR117686]

The __is_key_type specialization that matches a pair<key_type, T>
argument is intended for std::unordered_map, not for
std::unordered_set<std::pair<K,T>>.

This uses a pair<const Args&...> as the template argument for
__is_key_type, so that it won't match a set's key_type.

libstdc++-v3/ChangeLog:

PR libstdc++/117686
* include/bits/hashtable.h (_Hashtable::_M_emplace_uniq):
Adjust usage of __is_key_type to avoid false positive.
* testsuite/23_containers/unordered_set/insert/117686.cc:
New test.
libstdc++-v3/include/bits/hashtable.h
libstdc++-v3/testsuite/23_containers/unordered_set/insert/117686.cc [new file with mode: 0644]