tst_QFutureSynchronizer: describe how setFutureAliasingExistingMember() works
So no-one 'fixes' the test by pinning synchronizer.futures() into a named variable or collapsing the two lines into one. Both would break the premiss of the test. Amends e8dcbaaaf61ee2164db61e70a5d61d7a5b849371. Change-Id: I7a98c382a7db0bf3ff369dcaf61af0942796d6a3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 70a7a695fdbaccd042aa4371cbb231ced2d9b499) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f03c7e4a2d
commit
3343eeb1fb
@ -45,6 +45,11 @@ void tst_QFutureSynchronizer::setFutureAliasingExistingMember()
|
||||
// WHEN: calling setFuture() with an alias of the QFuture already in `synchronizer`:
|
||||
//
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
// The next line triggers -Wdangling-reference, but it's a FP because
|
||||
// of implicit sharing. We cannot keep a copy of synchronizer.futures()
|
||||
// around to avoid the warning, as the extra copy would cause a detach()
|
||||
// of m_futures inside setFuture() with the consequence that `f` no longer
|
||||
// aliases an element in m_futures, which is the goal of this test.
|
||||
const auto &f = synchronizer.futures().constFirst();
|
||||
synchronizer.setFuture(f);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user