From 52b46a7c46e00db0e2881d85748bab4418a533a9 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Tue, 4 Mar 2025 16:15:59 +0100 Subject: [PATCH] QFuture: avoid warnings about unreachable code with /W4 in MSVC ... when instantiating the MetaTypeQFutureHelper for QFuture. Simply enabling /W4 for tst_qfuture also generates this warning, but also much more. So I'm not providing any unit-test here. Amends 90d9a86c2e762c9426d0facbd54ed5dbff574ecd. Fixes: QTBUG-133406 Change-Id: I22a53b872818763b80f333f597ddd19a1c1e30ac Reviewed-by: Thiago Macieira (cherry picked from commit ff6bf61b17ee4fc8ca11e016242d7c3399a02045) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 7a7c7322fa820425aa4896bb15172e922dc974ea) --- src/corelib/thread/qfuture.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/thread/qfuture.h b/src/corelib/thread/qfuture.h index 4aacd97f233..ce448b7d8a1 100644 --- a/src/corelib/thread/qfuture.h +++ b/src/corelib/thread/qfuture.h @@ -437,11 +437,12 @@ template struct MetaTypeQFutureHelper> { static bool registerConverter() { - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { return false; - - return QMetaType::registerConverter, QFuture>( - [](const QFuture &future) { return QFuture(future); }); + } else { + return QMetaType::registerConverter, QFuture>( + [](const QFuture &future) { return QFuture(future); }); + } } };