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>
This commit is contained in:
Marc Mutz 2021-06-30 13:57:09 +02:00
parent e160cded0a
commit 6f27255cd4

View File

@ -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++);