QOffsetStringArray: fix -Werror=type-limits
GCC complains: qoffsetstringarray_p.h:85:27: error: comparison is always false due to limited range of data type [-Werror=type-limits] 85 | if constexpr (Highest <= (std::numeric_limits<quint8>::max)()) { | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix by casting the RHS (of limited-range type) to size_t, the type of the LHS. Fixes: QTBUG-109875 Change-Id: I494ea544b8b3bfd877443119eebc160eb2f8e063 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit cf145a34b494e08a10271de277f6c4e62b54ea4f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
60a2136533
commit
4732c9300b
@ -81,9 +81,11 @@ private:
|
||||
namespace QtPrivate {
|
||||
template <size_t Highest> constexpr auto minifyValue()
|
||||
{
|
||||
if constexpr (Highest <= (std::numeric_limits<quint8>::max)()) {
|
||||
constexpr size_t max8 = (std::numeric_limits<quint8>::max)();
|
||||
constexpr size_t max16 = (std::numeric_limits<quint16>::max)();
|
||||
if constexpr (Highest <= max8) {
|
||||
return quint8(Highest);
|
||||
} else if constexpr (Highest <= (std::numeric_limits<quint16>::max)()) {
|
||||
} else if constexpr (Highest <= max16) {
|
||||
return quint16(Highest);
|
||||
} else {
|
||||
// int is probably enough for everyone
|
||||
|
Loading…
x
Reference in New Issue
Block a user