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 f82cf6333e.

Pick-to: 6.7
Change-Id: Ibfb3e9b7fdcbe93c43b7873986c74b4b5a0c9e54
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
bb10
Marc Mutz 2024-05-17 22:48:21 +02:00 committed by Ahmad Samir
parent 725455ed33
commit 6736fe3a0f
1 changed files with 1 additions and 1 deletions

View File

@ -173,7 +173,7 @@ void tst_QSpan::onlyZeroExtentSpansHaveDefaultCtors() const
void tst_QSpan::zeroExtentSpansMaintainADataPointer() const
{
int i;
int i = 0;
QSpan<int, 0> si{&i, 0};
QCOMPARE(si.data(), &i);
check_empty_span_incl_subspans(si);