QRM: silence gcc warning that an array can never be nullptr
If T is a C-array, like it is in some of our tests, then an instance of that can never be nullptr, which recent gcc versions think warrants a compile time warning -Waddress. As a C array is a valid data structure to instantiate a QRangeModel from, silence that warning by handling the case explicitly. Pick-to: 6.10 Change-Id: I63090891988e677cf3ae2d871418b1abd4d1dc71 Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
This commit is contained in:
parent
dd81b42127
commit
7ac8815a19
@ -101,7 +101,9 @@ namespace QRangeModelDetails
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
static constexpr bool isValid(const T &t) noexcept
|
static constexpr bool isValid(const T &t) noexcept
|
||||||
{
|
{
|
||||||
if constexpr (is_validatable<T>())
|
if constexpr (std::is_array_v<T>)
|
||||||
|
return true;
|
||||||
|
else if constexpr (is_validatable<T>())
|
||||||
return bool(t);
|
return bool(t);
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user