From 9aeb38650d60857b949a130619f0ba32d52df923 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Fri, 11 Aug 2023 18:11:04 +0300 Subject: [PATCH] tst_QFreeList: build with QT_NO_FOREACH The container is local to the function, but can't be made const due to the way it's filled. The loop clearly doesn't modify the container so use std::as_const and ranged-for. Task-number: QTBUG-115839 Change-Id: Ia9f01dfaccfca3225fe0487aafd0a386605cf466 Reviewed-by: Volker Hilsheimer --- tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp index 827d1e56fd..680749938f 100644 --- a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp +++ b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp @@ -1,8 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - #include #include #include @@ -117,7 +115,7 @@ public: needToRelease << i; } while (t.elapsed() < TimeLimit); - foreach (int x, needToRelease) + for (int x : std::as_const(needToRelease)) freelist.release(x); } };