QWeakPointer: make default ctor constexpr

... and thereby also QPointer's.

Found by applying C++20 constinit around the codebase.

Change-Id: I9f149b2346624ca913c29b796f94ac7d24fe560a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit aaa74e8f99c91bb877e5f3a8ee4a8b313d2fa133)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-01-31 18:16:28 +01:00 committed by Qt Cherry-pick Bot
parent c7e94c8b7f
commit b7c1c2623a

View File

@ -571,7 +571,7 @@ public:
explicit operator bool() const noexcept { return !isNull(); }
bool operator !() const noexcept { return isNull(); }
inline QWeakPointer() noexcept : d(nullptr), value(nullptr) { }
constexpr QWeakPointer() noexcept : d(nullptr), value(nullptr) { }
inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; }
QWeakPointer(const QWeakPointer &other) noexcept : d(other.d), value(other.value)