diff --git a/src/random.h b/src/random.h index 203678b17c6..39bcd086f75 100644 --- a/src/random.h +++ b/src/random.h @@ -334,7 +334,7 @@ public: /** Generate a uniform random duration in the range [0..max). Precondition: max.count() > 0 */ template - Dur randrange(typename std::common_type_t range) noexcept + Dur randrange(std::common_type_t range) noexcept // Having the compiler infer the template argument from the function argument // is dangerous, because the desired return value generally has a different // type than the function argument. So std::common_type is used to force the diff --git a/src/randomenv.cpp b/src/randomenv.cpp index 903caef22ce..1811846677d 100644 --- a/src/randomenv.cpp +++ b/src/randomenv.cpp @@ -70,10 +70,10 @@ namespace { */ template CSHA512& operator<<(CSHA512& hasher, const T& data) { - static_assert(!std::is_same, char*>::value, "Calling operator<<(CSHA512, char*) is probably not what you want"); - static_assert(!std::is_same, unsigned char*>::value, "Calling operator<<(CSHA512, unsigned char*) is probably not what you want"); - static_assert(!std::is_same, const char*>::value, "Calling operator<<(CSHA512, const char*) is probably not what you want"); - static_assert(!std::is_same, const unsigned char*>::value, "Calling operator<<(CSHA512, const unsigned char*) is probably not what you want"); + static_assert(!std::is_same_v, char*>, "Calling operator<<(CSHA512, char*) is probably not what you want"); + static_assert(!std::is_same_v, unsigned char*>, "Calling operator<<(CSHA512, unsigned char*) is probably not what you want"); + static_assert(!std::is_same_v, const char*>, "Calling operator<<(CSHA512, const char*) is probably not what you want"); + static_assert(!std::is_same_v, const unsigned char*>, "Calling operator<<(CSHA512, const unsigned char*) is probably not what you want"); hasher.Write((const unsigned char*)&data, sizeof(data)); return hasher; } diff --git a/src/serialize.h b/src/serialize.h index c2b63205e1b..a1166b81a89 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -220,13 +220,13 @@ const Out& AsBase(const In& x) template \ void Serialize(Stream& s) const \ { \ - static_assert(std::is_same_v, "Serialize type mismatch"); \ + static_assert(std::is_same_v, "Serialize type mismatch"); \ Ser(s, *this); \ } \ template \ void Unserialize(Stream& s) \ { \ - static_assert(std::is_same_v, "Unserialize type mismatch"); \ + static_assert(std::is_same_v, "Unserialize type mismatch"); \ Unser(s, *this); \ } @@ -507,12 +507,12 @@ struct VarIntFormatter { template void Ser(Stream &s, I v) { - WriteVarInt>(s, v); + WriteVarInt>(s, v); } template void Unser(Stream& s, I& v) { - v = ReadVarInt>(s); + v = ReadVarInt>(s); } }; @@ -545,7 +545,7 @@ struct CustomUintFormatter template void Unser(Stream& s, I& v) { - using U = typename std::conditional, std::underlying_type, std::common_type>::type::type; + using U = typename std::conditional_t, std::underlying_type, std::common_type>::type; static_assert(std::numeric_limits::max() >= MAX && std::numeric_limits::min() <= 0, "Assigned type too small"); uint64_t raw = 0; if (BigEndian) { diff --git a/src/test/fuzz/FuzzedDataProvider.h b/src/test/fuzz/FuzzedDataProvider.h index 42f45b4c818..11f2fbdb8c8 100644 --- a/src/test/fuzz/FuzzedDataProvider.h +++ b/src/test/fuzz/FuzzedDataProvider.h @@ -277,8 +277,8 @@ template T FuzzedDataProvider::ConsumeProbability() { // Use different integral types for different floating point types in order // to provide better density of the resulting values. using IntegralType = - typename std::conditional<(sizeof(T) <= sizeof(uint32_t)), uint32_t, - uint64_t>::type; + typename std::conditional_t<(sizeof(T) <= sizeof(uint32_t)), uint32_t, + uint64_t>; T result = static_cast(ConsumeIntegral()); result /= static_cast(std::numeric_limits::max());