QUuid: fix qSwap() use in constexpr function
I don't know why the compilers didn't shout here, but what _should_ have happened is: - qSwap<quint64>() gets instantiated - the unqualified swap() call inside gets resolved to std::swap() - std::swap() is not constexpr in C++17, so qSwap<quint64>() silently gets its constexpr dropped - error, due to the use of non-constexpr function qSwap() in constexpr function bswap() There's no way through the function that doesn't hit the qSwap(), so that is also not the explanation. And, indeed, replacing qSwap() with std::swap() gets me the expected error... Before compilers get the idea, rewrite the code to not require swapping. Amends 686c02224c03735356bdab987bf62644eb34cc34. Pick-to: 6.6 Change-Id: Ie1364bb2fd148bf995a8ffd321f77a6021176928 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
30f87c86b4
commit
2bd8e63690
@ -192,9 +192,10 @@ private:
|
||||
static constexpr Id128Bytes bswap(Id128Bytes b)
|
||||
{
|
||||
// 128-bit byte swap
|
||||
b.data64[0] = qbswap(b.data64[0]);
|
||||
b.data64[1] = qbswap(b.data64[1]);
|
||||
qSwap(b.data64[0], b.data64[1]);
|
||||
auto b0 = qbswap(b.data64[0]);
|
||||
auto b1 = qbswap(b.data64[1]);
|
||||
b.data64[0] = b1;
|
||||
b.data64[1] = b0;
|
||||
return b;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user