https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105907
Bug ID: 105907 Summary: unordered containers should cache result of std::hash<std::pmr::string> Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: ABI Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- The std::hash specializations for PMR strings do not have corresponding specializations of the __is_fast_hash trait, which means they use the default i.e. fast-hash == true. This means that unordered containers do not bother to cache the hash code. This is wrong, hashing PMR strings is exactly as slow as hashing non-PMR strings. But changing it now would be an ABI break for e.g. std::unordered_set<std::pmr::string> because it would add a hash code member to each node. Similarly, adding specializations of __is_fast_hash corresponding to the changes for https://wg21.link/lwg3705 ("Hashability shouldn't depend on basic_string's allocator") will be an ABI break for e.g. std::unordered_set<std::basic_string<char, std::char_traits<char>, MyAlloc>> We really should have just defined __is_fast_hash to be true for all specializations of basic_string, instead of only the ones that have a predefined std::hash specialization.