diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 99398340f6..c7017b8511 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -201,7 +201,8 @@ void tst_QLocale::initTestCase() // Get an environment free of any locale-related variables cleanEnv.clear(); - foreach (QString const& entry, QProcess::systemEnvironment()) { + const QStringList sysenv = QProcess::systemEnvironment(); + for (const QString &entry : sysenv) { if (entry.startsWith("LANG=") || entry.startsWith("LC_") || entry.startsWith("LANGUAGE=")) continue; cleanEnv << entry;