summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2021-06-30 13:57:09 +0200
committerMarc Mutz <marc.mutz@kdab.com>2021-06-30 23:13:28 +0200
commit6f27255cd40ea4bd12a27737096051e4fa9945b3 (patch)
tree940df81b7012857b5851a2286887dbb28097b5ed /tests/auto/corelib
parente160cded0ac6e08aaf3fdce55b567ed26bc40f34 (diff)
tst_qglobal: fix an uninit'ed variable warning
GCC can't see through all the foreach code to determine whether the loop will execute at least once, so don't play hardballs with the compiler and initialize the variable. Change-Id: I95756a99eda497a25aa277046df9895f558758c3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index 3d8759fba5..a5bf9cf34f 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -134,7 +134,7 @@ void tst_QGlobal::for_each()
QCOMPARE(counter, list.count());
// Should also work with an existing variable
- int local;
+ int local = 0;
counter = 0;
foreach (local, list) {
QCOMPARE(local, counter++);