]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Improve diagnostics for invalid std::hash specializations [PR115420]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 11 Jun 2024 10:08:12 +0000 (11:08 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 13 Jun 2024 13:08:36 +0000 (14:08 +0100)
commitcc38bdf093c44918edff819ae6c73d03c726b341
treea90c3cee080c5d2e7e519b186f95d62102024961
parent99a1fe6c12c733fe4923a75a79d09a66ff8abcec
libstdc++: Improve diagnostics for invalid std::hash specializations [PR115420]

When using a key type without a valid std::hash specialization the
unordered containers give confusing diagnostics about the default
constructor being deleted. Add a static_assert that will fail for
disabled std::hash specializations (and for a subset of custom hash
functions).

libstdc++-v3/ChangeLog:

PR libstdc++/115420
* include/bits/hashtable.h (_Hashtable): Add static_assert to
check that hash function is copy constructible.
* testsuite/23_containers/unordered_map/115420.cc: New test.
libstdc++-v3/include/bits/hashtable.h
libstdc++-v3/testsuite/23_containers/unordered_map/115420.cc [new file with mode: 0644]