diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-03-24 08:44:53 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-03-28 09:09:14 +0000 |
commit | f8dba0395f6024d5d6a7b3112b9970693cb55dfd (patch) | |
tree | ccefd2b98989a635ee63757b28b51d9edeaedcca /tests/auto/corelib/thread/qpromise/tst_qpromise.cpp | |
parent | f1e539518b595e48f2e1e6a8eec1263b47148e3a (diff) |
QPromise: add support for addResult(braced-initializer)
The usual problem, the usual fix: default the addResult() template
argument to the class template argument, cf. e.g. wg21.link/p2218.
[ChangeLog][QtCore][QPromise] Added support for calls to addResult()
with braced initializers.
Fixes: QTBUG-111826
Change-Id: I9ad7294dbcefbc5d2609ca3d9e7304dbeb8b3f41
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib/thread/qpromise/tst_qpromise.cpp')
-rw-r--r-- | tests/auto/corelib/thread/qpromise/tst_qpromise.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp index 6c23884b36..09332f92ef 100644 --- a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp +++ b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp @@ -24,6 +24,7 @@ private slots: void promise(); void futureFromPromise(); void addResult(); + void addResultWithBracedInitializer(); void addResultOutOfOrder(); #ifndef QT_NO_EXCEPTIONS void setException(); @@ -196,6 +197,20 @@ void tst_QPromise::addResult() } } +void tst_QPromise::addResultWithBracedInitializer() // QTBUG-111826 +{ + struct MyClass + { + QString strValue; + int intValue = 0; + }; + + { + QPromise<MyClass> myPromise; + myPromise.addResult({"bar", 1}); + } +} + void tst_QPromise::addResultOutOfOrder() { // Compare results available in QFuture to expected results |