From ff6bf61b17ee4fc8ca11e016242d7c3399a02045 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 Pick-to: 6.9 6.9.0 6.8 6.5 Change-Id: I22a53b872818763b80f333f597ddd19a1c1e30ac Reviewed-by: Thiago Macieira --- 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 3c75365d096..b6320be65db 100644 --- a/src/corelib/thread/qfuture.h +++ b/src/corelib/thread/qfuture.h @@ -438,11 +438,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); }); + } } };