diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index fef43dab03..d2a7390938 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -19,8 +19,7 @@ QT_BEGIN_NAMESPACE -template static QVariant::PrivateShared * -customConstructShared(size_t size, size_t align, F &&construct) +inline auto customConstructSharedImpl(size_t size, size_t align) { struct Deleter { void operator()(QVariant::PrivateShared *p) const @@ -30,6 +29,13 @@ customConstructShared(size_t size, size_t align, F &&construct) // this is exception-safe std::unique_ptr ptr; ptr.reset(QVariant::PrivateShared::create(size, align)); + return ptr; +} + +template static QVariant::PrivateShared * +customConstructShared(size_t size, size_t align, F &&construct) +{ + auto ptr = customConstructSharedImpl(size, align); construct(ptr->data()); return ptr.release(); }