From db3d097db2e2bd5fe545d570b49bfbe0754fbc16 Mon Sep 17 00:00:00 2001 From: Andrei Golubev Date: Thu, 15 Oct 2020 10:02:46 +0200 Subject: [PATCH] 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 as this is sufficient to account for both cases: QPromise and QPromise with input, convertible to T Change-Id: I657998c0e26241b0fc5e70988622984ece8871df Reviewed-by: Sona Kurazyan --- src/corelib/thread/qpromise.h | 4 +--- 1 file changed, 1 insertion(+), 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 future() const { return d.future(); } - template>, - typename = QtPrivate::EnableIfSameOrConvertible, std::decay_t>> + template> bool addResult(U &&result, int index = -1) { return d.reportResult(std::forward(result), index);