QVariant: de-duplicate customConstructShared()
Commit 3ad9f94ff2de3a1f812bb0139ff31e31d5ffb529 (Feb 2023) moved it to qvariant_p.h but commit 79ae79d05c65019233cf9ae9e77ef59d90e75ac2 (authored Sep 2022 but committed June 2023) brought it back, probably by accident due to conflict resolution during rebasing. For some reason, no compiler in our CI complains about it, but ICX 2023 (based on unrelased Clang versions) did: variant_p.h(101,23): error: call to 'customConstructShared' is ambiguous Fixes: QTBUG-116496 Change-Id: Ifa1111900d6945ea8e05fffd177eab656a2dc507 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit bed203a6fccb77e008dc384615b0ffaae6e14b54) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
bd4ab9c23c
commit
724f7fb6c8
@ -245,22 +245,6 @@ enum CustomConstructNullabilityOption {
|
||||
// future option: AlwaysNull?
|
||||
};
|
||||
|
||||
|
||||
template <typename F> static QVariant::PrivateShared *
|
||||
customConstructShared(size_t size, size_t align, F &&construct)
|
||||
{
|
||||
struct Deleter {
|
||||
void operator()(QVariant::PrivateShared *p) const
|
||||
{ QVariant::PrivateShared::free(p); }
|
||||
};
|
||||
|
||||
// this is exception-safe
|
||||
std::unique_ptr<QVariant::PrivateShared, Deleter> ptr;
|
||||
ptr.reset(QVariant::PrivateShared::create(size, align));
|
||||
construct(ptr->data());
|
||||
return ptr.release();
|
||||
}
|
||||
|
||||
// the type of d has already been set, but other field are not set
|
||||
template <CustomConstructMoveOptions moveOption = UseCopy, CustomConstructNullabilityOption nullability = MaybeNull>
|
||||
static void customConstruct(const QtPrivate::QMetaTypeInterface *iface, QVariant::Private *d,
|
||||
|
Loading…
x
Reference in New Issue
Block a user