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 <marc.mutz@qt.io>
This commit is contained in:
Ahmad Samir 2023-08-14 18:59:16 +03:00
parent 5d336dad4b
commit fc6339e4bb

View File

@ -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 <QTest>
#include <QtCore/QString>
#include <QtCore/qarraydata.h>
@ -418,7 +416,7 @@ struct Deallocator
~Deallocator()
{
Q_FOREACH (QArrayData *data, headers)
for (QArrayData *data : std::as_const(headers))
QArrayData::deallocate(data, objectSize, alignment);
}