From 077ffcebc7c40b03610fcf23428349bd5812965c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 17 May 2024 22:48:21 +0200 Subject: [PATCH] tst_QSpan: fix GCC 11 -Wmaybe-uninitialized GCC 11 doesn't understand that 'i' isn't ever read from (because all spans created over it have size zero), but initialize it nonetheless to suppress the warning. Amends f82cf6333e4e21c96d8b6bb272392f8142ead2b7. Change-Id: Ibfb3e9b7fdcbe93c43b7873986c74b4b5a0c9e54 Reviewed-by: Ahmad Samir (cherry picked from commit 6736fe3a0f33d2c37927a79203999acb8ef7b343) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/tools/qspan/tst_qspan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/corelib/tools/qspan/tst_qspan.cpp b/tests/auto/corelib/tools/qspan/tst_qspan.cpp index 91d2ecf739a..b8fcd0cdde3 100644 --- a/tests/auto/corelib/tools/qspan/tst_qspan.cpp +++ b/tests/auto/corelib/tools/qspan/tst_qspan.cpp @@ -173,7 +173,7 @@ void tst_QSpan::onlyZeroExtentSpansHaveDefaultCtors() const void tst_QSpan::zeroExtentSpansMaintainADataPointer() const { - int i; + int i = 0; QSpan si{&i, 0}; QCOMPARE(si.data(), &i); check_empty_span_incl_subspans(si);