diff --git a/src/corelib/tools/qoffsetstringarray_p.h b/src/corelib/tools/qoffsetstringarray_p.h index 3272e4dce9e..9103606a137 100644 --- a/src/corelib/tools/qoffsetstringarray_p.h +++ b/src/corelib/tools/qoffsetstringarray_p.h @@ -81,9 +81,11 @@ private: namespace QtPrivate { template constexpr auto minifyValue() { - if constexpr (Highest <= (std::numeric_limits::max)()) { + constexpr size_t max8 = (std::numeric_limits::max)(); + constexpr size_t max16 = (std::numeric_limits::max)(); + if constexpr (Highest <= max8) { return quint8(Highest); - } else if constexpr (Highest <= (std::numeric_limits::max)()) { + } else if constexpr (Highest <= max16) { return quint16(Highest); } else { // int is probably enough for everyone