https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121071
Bug ID: 121071
Summary: std::hash<__int128> and std::hash<long long> ignore
bits >= SIZE_WIDTH
Product: gcc
Version: 15.1.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: ---
For all integer types std::hash just returns the original value:
template<> \
struct hash<_Tp> : public __hash_base<size_t, _Tp> \
{ \
size_t \
operator()(_Tp __val) const noexcept \
{ return static_cast<size_t>(__val); } \
};
For types wider than size_t this discards all the high bits