From b2004620bdbc55aededf32dbf67568a153f24c94 Mon Sep 17 00:00:00 2001 From: Dennis Oberst Date: Wed, 12 Jul 2023 16:51:26 +0200 Subject: [PATCH] QNativeIpcKey: add implicit default ctor Add an implicitly callable default ctor, to enable default returns, but still disallow implicit conversion whilst assigning: QNativeIpcKey k = QNativeIpcKey::Type::~~ // not allowed auto fn = []() -> QNativeIpcKey { return {}; } // allowed Change-Id: I0f8476a588b3931f0e1f41a6c3a3fd8f2eb75b93 Reviewed-by: Marc Mutz (cherry picked from commit 08605f0d7848533bd62b9114dd0e5b175dd00aa3) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/ipc/qtipccommon.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/corelib/ipc/qtipccommon.h b/src/corelib/ipc/qtipccommon.h index 5640b6ff6db..34d6edf03d6 100644 --- a/src/corelib/ipc/qtipccommon.h +++ b/src/corelib/ipc/qtipccommon.h @@ -37,7 +37,11 @@ public: ; static Type legacyDefaultTypeForOs() noexcept; - explicit constexpr QNativeIpcKey(Type type = DefaultTypeForOs) noexcept + constexpr QNativeIpcKey() noexcept + : QNativeIpcKey(DefaultTypeForOs) + {} + + explicit constexpr QNativeIpcKey(Type type) noexcept : d() { typeAndFlags.type = type;