Workaround gcc compiler bug

For the comparison of a QFuture<int> and an int, gcc creates code that
creates a qfloat16 instance, as can be seen when stepping through this
code:

    QFuture<int> future;
    int five = 5;
    if (future == five)
        return five;

Explicitly get the result of the QFuture to compare as a workaround.

Change-Id: Id2adc2268dbc0ccec7df3a9786c9d29dcdc04da3
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-10-29 13:33:22 +01:00
parent d2b50a736b
commit 387f3e00a8
2 changed files with 16 additions and 16 deletions

View File

@ -462,7 +462,7 @@ void tst_QtConcurrentFilter::filteredReduced()
// rvalue sequences
auto future = QtConcurrent::filteredReduced(std::vector { 1, 2, 3, 4 }, keepEvenIntegers,
intSumReduce);
QCOMPARE(future, intSum);
QCOMPARE(future.result(), intSum);
auto result = QtConcurrent::blockingFilteredReduced(std::vector { 1, 2, 3, 4 },
keepEvenIntegers, intSumReduce);
@ -473,7 +473,7 @@ void tst_QtConcurrentFilter::filteredReduced()
// move only sequences
auto future = QtConcurrent::filteredReduced(MoveOnlyVector({ 1, 2, 3, 4 }),
keepEvenIntegers, intSumReduce);
QCOMPARE(future, intSum);
QCOMPARE(future.result(), intSum);
auto result = QtConcurrent::blockingFilteredReduced(MoveOnlyVector({ 1, 2, 3, 4 }),
keepEvenIntegers, intSumReduce);
@ -560,7 +560,7 @@ void tst_QtConcurrentFilter::filteredReducedThreadPool()
// rvalue sequences
auto future = QtConcurrent::filteredReduced(&pool, std::vector { 1, 2, 3, 4 },
keepOddIntegers, intSumReduce);
QCOMPARE(future, intSum);
QCOMPARE(future.result(), intSum);
auto result = QtConcurrent::blockingFilteredReduced(&pool, std::vector { 1, 2, 3, 4 },
keepOddIntegers, intSumReduce);
@ -571,7 +571,7 @@ void tst_QtConcurrentFilter::filteredReducedThreadPool()
// move only sequences
auto future = QtConcurrent::filteredReduced(&pool, MoveOnlyVector({ 1, 2, 3, 4 }),
keepOddIntegers, intSumReduce);
QCOMPARE(future, intSum);
QCOMPARE(future.result(), intSum);
auto result = QtConcurrent::blockingFilteredReduced(&pool, MoveOnlyVector({ 1, 2, 3, 4 }),
keepOddIntegers, intSumReduce);
@ -778,7 +778,7 @@ void tst_QtConcurrentFilter::filteredReducedInitialValue()
// rvalue sequences
auto future = QtConcurrent::filteredReduced(std::vector { 1, 2, 3, 4 }, keepEvenIntegers,
intSumReduce, intInitial);
QCOMPARE(future, intSum);
QCOMPARE(future.result(), intSum);
auto result = QtConcurrent::blockingFilteredReduced(
std::vector { 1, 2, 3, 4 }, keepEvenIntegers, intSumReduce, intInitial);
@ -789,7 +789,7 @@ void tst_QtConcurrentFilter::filteredReducedInitialValue()
// move only sequences
auto future = QtConcurrent::filteredReduced(MoveOnlyVector({ 1, 2, 3, 4 }),
keepEvenIntegers, intSumReduce, intInitial);
QCOMPARE(future, intSum);
QCOMPARE(future.result(), intSum);
auto result = QtConcurrent::blockingFilteredReduced(
MoveOnlyVector({ 1, 2, 3, 4 }), keepEvenIntegers, intSumReduce, intInitial);
@ -888,7 +888,7 @@ void tst_QtConcurrentFilter::filteredReducedInitialValueThreadPool()
// rvalue sequences
auto future = QtConcurrent::filteredReduced(&pool, std::vector { 1, 2, 3, 4 },
keepOddIntegers, intSumReduce, intInitial);
QCOMPARE(future, intSum);
QCOMPARE(future.result(), intSum);
auto result = QtConcurrent::blockingFilteredReduced(
&pool, std::vector { 1, 2, 3, 4 }, keepOddIntegers, intSumReduce, intInitial);
@ -899,7 +899,7 @@ void tst_QtConcurrentFilter::filteredReducedInitialValueThreadPool()
// move only sequences
auto future = QtConcurrent::filteredReduced(&pool, MoveOnlyVector({ 1, 2, 3, 4 }),
keepOddIntegers, intSumReduce, intInitial);
QCOMPARE(future, intSum);
QCOMPARE(future.result(), intSum);
auto result = QtConcurrent::blockingFilteredReduced(
&pool, MoveOnlyVector({ 1, 2, 3, 4 }), keepOddIntegers, intSumReduce, intInitial);

View File

@ -770,7 +770,7 @@ void tst_QtConcurrentMap::mappedReduced()
{
// rvalue sequences
auto future = QtConcurrent::mappedReduced(std::vector { 1, 2, 3 }, intSquare, intSumReduce);
QCOMPARE(future, sumOfSquares);
QCOMPARE(future.result(), sumOfSquares);
auto result = QtConcurrent::blockingMappedReduced(std::vector { 1, 2, 3 }, intSquare,
intSumReduce);
@ -781,7 +781,7 @@ void tst_QtConcurrentMap::mappedReduced()
// move only sequences
auto future =
QtConcurrent::mappedReduced(MoveOnlyVector({ 1, 2, 3 }), intSquare, intSumReduce);
QCOMPARE(future, sumOfSquares);
QCOMPARE(future.result(), sumOfSquares);
auto result = QtConcurrent::blockingMappedReduced(MoveOnlyVector({ 1, 2, 3 }), intSquare,
intSumReduce);
@ -878,7 +878,7 @@ void tst_QtConcurrentMap::mappedReducedThreadPool()
// rvalue sequences
auto future =
QtConcurrent::mappedReduced(&pool, std::vector { 1, 2, 3 }, intCube, intSumReduce);
QCOMPARE(future, sumOfCubes);
QCOMPARE(future.result(), sumOfCubes);
auto result = QtConcurrent::blockingMappedReduced(&pool, std::vector { 1, 2, 3 }, intCube,
intSumReduce);
@ -889,7 +889,7 @@ void tst_QtConcurrentMap::mappedReducedThreadPool()
// move only sequences
auto future = QtConcurrent::mappedReduced(&pool, MoveOnlyVector({ 1, 2, 3 }), intCube,
intSumReduce);
QCOMPARE(future, sumOfCubes);
QCOMPARE(future.result(), sumOfCubes);
auto result = QtConcurrent::blockingMappedReduced(&pool, MoveOnlyVector({ 1, 2, 3 }),
intCube, intSumReduce);
@ -1062,7 +1062,7 @@ void tst_QtConcurrentMap::mappedReducedInitialValue()
// rvalue sequences
auto future = QtConcurrent::mappedReduced(std::vector { 1, 2, 3 }, intSquare, intSumReduce,
intInitial);
QCOMPARE(future, sumOfSquares);
QCOMPARE(future.result(), sumOfSquares);
auto result = QtConcurrent::blockingMappedReduced(std::vector { 1, 2, 3 }, intSquare,
intSumReduce, intInitial);
@ -1073,7 +1073,7 @@ void tst_QtConcurrentMap::mappedReducedInitialValue()
// move only sequences
auto future = QtConcurrent::mappedReduced(MoveOnlyVector({ 1, 2, 3 }), intSquare,
intSumReduce, intInitial);
QCOMPARE(future, sumOfSquares);
QCOMPARE(future.result(), sumOfSquares);
auto result = QtConcurrent::blockingMappedReduced(MoveOnlyVector({ 1, 2, 3 }), intSquare,
intSumReduce, intInitial);
@ -1169,7 +1169,7 @@ void tst_QtConcurrentMap::mappedReducedInitialValueThreadPool()
// rvalue sequences
auto future = QtConcurrent::mappedReduced(&pool, std::vector { 1, 2, 3 }, intCube,
intSumReduce, intInitial);
QCOMPARE(future, sumOfCubes);
QCOMPARE(future.result(), sumOfCubes);
auto result = QtConcurrent::blockingMappedReduced(&pool, std::vector { 1, 2, 3 }, intCube,
intSumReduce, intInitial);
@ -1180,7 +1180,7 @@ void tst_QtConcurrentMap::mappedReducedInitialValueThreadPool()
// move only sequences
auto future = QtConcurrent::mappedReduced(&pool, MoveOnlyVector({ 1, 2, 3 }), intCube,
intSumReduce, intInitial);
QCOMPARE(future, sumOfCubes);
QCOMPARE(future.result(), sumOfCubes);
auto result = QtConcurrent::blockingMappedReduced(&pool, MoveOnlyVector({ 1, 2, 3 }),
intCube, intSumReduce, intInitial);