summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2014-02-10 17:11:08 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-11 13:28:35 +0100
commitcbc6387a2885b17c372d14ceee87c1fba893b97b (patch)
tree4845d82d6994975d90b46c07001004ebe5844cd7 /tests/auto/corelib/global/qglobal/tst_qglobal.cpp
parent5428db88de40378d0419aea40515d98241d733bc (diff)
support c'tor as second parameter in foreach macro
Passing a constructor as second argument to foreach didn't work when building with gcc. For MSVC this already worked as a different foreach implementation is used. Change-Id: Id98444c699b4cebc14ea62076c5f7cba33ffb824 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'tests/auto/corelib/global/qglobal/tst_qglobal.cpp')
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index 0d08e912f8..4eb3e4fc98 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -101,6 +101,13 @@ void tst_QGlobal::for_each()
QCOMPARE(i, counter++);
}
QCOMPARE(counter, list.count());
+
+ // check whether we can pass a constructor as container argument
+ counter = 0;
+ foreach (int i, QList<int>(list)) {
+ QCOMPARE(i, counter++);
+ }
+ QCOMPARE(counter, list.count());
}
void tst_QGlobal::qassert()