From b5e05f32e6092b2c3becfff9e7cfbfa6c3c87f45 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 11 Jun 2025 11:25:17 +0200 Subject: [PATCH] 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. Change-Id: I63090891988e677cf3ae2d871418b1abd4d1dc71 Reviewed-by: Matthias Rauter (cherry picked from commit 7ac8815a1943ced73a1c34a05ec7db318f6957d1) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/itemmodels/qrangemodel_impl.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/itemmodels/qrangemodel_impl.h b/src/corelib/itemmodels/qrangemodel_impl.h index af161199ebb..ab10bc316ca 100644 --- a/src/corelib/itemmodels/qrangemodel_impl.h +++ b/src/corelib/itemmodels/qrangemodel_impl.h @@ -101,7 +101,9 @@ namespace QRangeModelDetails template static constexpr bool isValid(const T &t) noexcept { - if constexpr (is_validatable()) + if constexpr (std::is_array_v) + return true; + else if constexpr (is_validatable()) return bool(t); else return true;