Export of internal Abseil changes.
-- 2d7c9650fe2b1bf76085a993285e49db4d24aa4f by Derek Mauro <dmauro@google.com>: Fix a build error in hash_test.cc under MSVC 2017 PiperOrigin-RevId: 249666534 -- 66887d4ed411663f688fc9852701d648fe7cefe6 by Derek Mauro <dmauro@google.com>: Merge GitHub #316 - Avoid undefined behavior when passing nullptr to memcpy with size 0. Fixes #315 PiperOrigin-RevId: 249570899 GitOrigin-RevId: 2d7c9650fe2b1bf76085a993285e49db4d24aa4f Change-Id: I0fae0c581f3c0df9e6f70c69661973d020155738
This commit is contained in:
parent
27c30ec671
commit
4adaf54909
1 changed files with 2 additions and 1 deletions
|
@ -524,6 +524,7 @@ struct MinTag<a> : InvokeTagConstant<a> {};
|
||||||
|
|
||||||
template <InvokeTag... Tags>
|
template <InvokeTag... Tags>
|
||||||
struct CustomHashType {
|
struct CustomHashType {
|
||||||
|
explicit CustomHashType(size_t val) : value(val) {}
|
||||||
size_t value;
|
size_t value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -590,7 +591,7 @@ void TestCustomHashType(InvokeTagConstant<InvokeTag::kNone>, T...) {
|
||||||
EXPECT_TRUE(is_hashable<const type&>());
|
EXPECT_TRUE(is_hashable<const type&>());
|
||||||
|
|
||||||
const size_t offset = static_cast<int>(std::min({T::value...}));
|
const size_t offset = static_cast<int>(std::min({T::value...}));
|
||||||
EXPECT_EQ(SpyHash(type{7}), SpyHash(size_t{7 + offset}));
|
EXPECT_EQ(SpyHash(type(7)), SpyHash(size_t{7 + offset}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestCustomHashType(InvokeTagConstant<InvokeTag::kNone>) {
|
void TestCustomHashType(InvokeTagConstant<InvokeTag::kNone>) {
|
||||||
|
|
Loading…
Reference in a new issue