Fix build with g++ 10.2
g++ 10.2 complains here that a comparison of "Last" with "std::numeric_limits<quint8>::max()" is always false when "Last" is an int greater than 256. This is because "std::numeric_limits<quint8>::max() returns an quint8. Since parts of Qt are built with -Werror, the build fails. Fixed by adding a unary plus (+). Change-Id: I16a6b9f6952aeddf0a2a04d87746e433927122bf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
97de53ee8c
commit
3c4e94d12c
@ -65,9 +65,11 @@ struct OffsetSequenceHelper : OffsetSequenceHelper<N - 1, O + I, Idx..., O> { };
|
||||
template<int Last, int I, int S, int ... Idx>
|
||||
struct OffsetSequenceHelper<1, Last, I, S, Idx...> : IndexesList<Last + I, Idx..., Last>
|
||||
{
|
||||
// the unary + before std::numeric_limits below is required. Otherwise we get on g++-10.2:
|
||||
// error: comparison is always false due to limited range of data type [-Werror=type-limits]
|
||||
static const constexpr auto Length = Last + I;
|
||||
using Type = typename std::conditional<
|
||||
Last <= std::numeric_limits<quint8>::max(),
|
||||
Last <= +std::numeric_limits<quint8>::max(),
|
||||
quint8,
|
||||
typename std::conditional<
|
||||
Last <= std::numeric_limits<quint16>::max(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user