diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2020-10-15 10:02:46 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2020-10-16 09:48:10 +0200 |
commit | db3d097db2e2bd5fe545d570b49bfbe0754fbc16 (patch) | |
tree | fe002e5b6ffc790d26d145861c76260fa15e09a6 /src | |
parent | 7332d3937dbad3b0995eb38d6e06cc0220a1d2d0 (diff) |
Fix subtle SFINAE problem in QPromise::addResult
Accidentally found out that we enable/disable QPromise::addResult based
on type deduced from input argument, instead of using "value_type" of
QPromise itself, which is wrong
Simplified the checks to a single one -
EnableIfSameOrConvertible<InputType, StoredType> as this is sufficient
to account for both cases: QPromise<void> and QPromise<T> with input,
convertible to T
Change-Id: I657998c0e26241b0fc5e70988622984ece8871df
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qpromise.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/thread/qpromise.h b/src/corelib/thread/qpromise.h index 225ce3dee1..68645ef084 100644 --- a/src/corelib/thread/qpromise.h +++ b/src/corelib/thread/qpromise.h @@ -86,9 +86,7 @@ public: // Core QPromise APIs QFuture<T> future() const { return d.future(); } - template<typename U = T, - typename = QtPrivate::EnableForNonVoid<std::decay_t<U>>, - typename = QtPrivate::EnableIfSameOrConvertible<std::decay_t<U>, std::decay_t<T>>> + template<typename U, typename = QtPrivate::EnableIfSameOrConvertible<U, T>> bool addResult(U &&result, int index = -1) { return d.reportResult(std::forward<U>(result), index); |