From fc6339e4bbe1fbb8b955b3c8b18e4b8037add3c9 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Mon, 14 Aug 2023 18:59:16 +0300 Subject: [PATCH] tst_QArrayData: compile with QT_NO_FOREACH The container is a member of Deallocator class, it's iterated over in the destructor to free allocated resources, and it's not being changed during iteration >>> ranged-for and std::as_const. Task-number: QTBUG-115839 Change-Id: I54eb115013805284c77691f1bd0a8d6085a4c867 Reviewed-by: Marc Mutz --- tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index fdadf58c332..5804aeeb1e5 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp @@ -1,8 +1,6 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - #include #include #include @@ -418,7 +416,7 @@ struct Deallocator ~Deallocator() { - Q_FOREACH (QArrayData *data, headers) + for (QArrayData *data : std::as_const(headers)) QArrayData::deallocate(data, objectSize, alignment); }