Skip to content

Commit

Permalink
libstdc++: std::hash::operator is not constexpr
Browse files Browse the repository at this point in the history
The overloads of std::hash::operator cannot be constexpr as
std::hash::operator, as defined libstdc++, are not constexpr either.

Apparently this is also what C++ standard specifies, though it would
be quite convenient that std::hash::operator would be defined as
constexpr.

Bug: 957519
Change-Id: I80b93e83cc5352dd1ba5ab4979c6051818dac82d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4372589
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122458}
  • Loading branch information
jdapena authored and Chromium LUCI CQ committed Mar 27, 2023
1 parent aad17d3 commit 845c577
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/containers/id_map_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct RepeatingKeyType {
namespace std {
template <>
struct hash<::base::test::id_map::RepeatingKeyType> {
constexpr size_t operator()(
size_t operator()(
const ::base::test::id_map::RepeatingKeyType& k) const noexcept {
return std::hash<int>()(k.i);
}
Expand Down

0 comments on commit 845c577

Please sign in to comment.