diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-09-25 13:26:14 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-09-26 12:53:25 -0700 |
commit | bf7732baca43537b11ba8989d7e68fa9a9a6696d (patch) | |
tree | 9e35271b49727da465de0650a4055828095e8134 /src/corelib/thread | |
parent | deec34c2fb496c8f96b76d456d27a2824622f401 (diff) |
QFuture: fix headercheck warning with Clang 17: member shadowing
Pretty sure this is a Clang bug because the promise member that it says
is getting shadowed shouldn't be in scope (`this` isn't being captured).
qfuture_impl.h:538:60: error: declaration shadows a field of 'Continuation<Function, ResultType, ParentResultType>' [-Werror,-Wshadow]
qfuture_impl.h:327:26: note: previous declaration is here
Pick-to: 6.5 6.6
Change-Id: Ifeb6206a9fa04424964bfffd17883e21cfec6d8e
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qfuture_impl.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/corelib/thread/qfuture_impl.h b/src/corelib/thread/qfuture_impl.h index bf98071646..460637fcf6 100644 --- a/src/corelib/thread/qfuture_impl.h +++ b/src/corelib/thread/qfuture_impl.h @@ -535,18 +535,18 @@ void Continuation<Function, ResultType, ParentResultType>::create(F &&func, fi.setLaunchAsync(launchAsync); - auto continuation = [func = std::forward<F>(func), fi, promise = QPromise(fi), pool, + auto continuation = [func = std::forward<F>(func), fi, promise_ = QPromise(fi), pool, launchAsync](const QFutureInterfaceBase &parentData) mutable { const auto parent = QFutureInterface<ParentResultType>(parentData).future(); Continuation<Function, ResultType, ParentResultType> *continuationJob = nullptr; if (launchAsync) { auto asyncJob = new AsyncContinuation<Function, ResultType, ParentResultType>( - std::forward<Function>(func), parent, std::move(promise), pool); + std::forward<Function>(func), parent, std::move(promise_), pool); fi.setRunnable(asyncJob); continuationJob = asyncJob; } else { continuationJob = new SyncContinuation<Function, ResultType, ParentResultType>( - std::forward<Function>(func), parent, std::move(promise)); + std::forward<Function>(func), parent, std::move(promise_)); } bool isLaunched = continuationJob->execute(); @@ -573,11 +573,11 @@ void Continuation<Function, ResultType, ParentResultType>::create(F &&func, fi.setLaunchAsync(true); fi.setThreadPool(pool); - auto continuation = [func = std::forward<F>(func), promise = QPromise(fi), + auto continuation = [func = std::forward<F>(func), promise_ = QPromise(fi), pool](const QFutureInterfaceBase &parentData) mutable { const auto parent = QFutureInterface<ParentResultType>(parentData).future(); auto continuationJob = new AsyncContinuation<Function, ResultType, ParentResultType>( - std::forward<Function>(func), parent, std::move(promise), pool); + std::forward<Function>(func), parent, std::move(promise_), pool); bool isLaunched = continuationJob->execute(); // If continuation is successfully launched, AsyncContinuation will be deleted // by the QThreadPool which has started it. @@ -615,9 +615,9 @@ void Continuation<Function, ResultType, ParentResultType>::create(F &&func, // continuation callback is destroyed. The promise that is created in the capture list is // destroyed and, if it is not yet finished, cancelled. auto continuation = [func = std::forward<F>(func), parent = *f, - promise = QPromise(fi)]() mutable { + promise_ = QPromise(fi)]() mutable { SyncContinuation<Function, ResultType, ParentResultType> continuationJob( - std::forward<Function>(func), parent, std::move(promise)); + std::forward<Function>(func), parent, std::move(promise_)); continuationJob.execute(); }; @@ -687,11 +687,11 @@ void FailureHandler<Function, ResultType>::create(F &&function, QFuture<ResultTy { Q_ASSERT(future); - auto failureContinuation = [function = std::forward<F>(function), promise = QPromise(fi)]( + auto failureContinuation = [function = std::forward<F>(function), promise_ = QPromise(fi)]( const QFutureInterfaceBase &parentData) mutable { const auto parent = QFutureInterface<ResultType>(parentData).future(); FailureHandler<Function, ResultType> failureHandler(std::forward<Function>(function), - parent, std::move(promise)); + parent, std::move(promise_)); failureHandler.run(); }; @@ -707,9 +707,9 @@ void FailureHandler<Function, ResultType>::create(F &&function, QFuture<ResultTy Q_ASSERT(future); Q_ASSERT(context); auto failureContinuation = [function = std::forward<F>(function), - parent = *future, promise = QPromise(fi)]() mutable { + parent = *future, promise_ = QPromise(fi)]() mutable { FailureHandler<Function, ResultType> failureHandler( - std::forward<Function>(function), parent, std::move(promise)); + std::forward<Function>(function), parent, std::move(promise_)); failureHandler.run(); }; |