From 6f27255cd40ea4bd12a27737096051e4fa9945b3 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 30 Jun 2021 13:57:09 +0200 Subject: [PATCH] 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 Reviewed-by: Edward Welbourne --- tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 3d8759fba58..a5bf9cf34f2 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++);