Details
Description
QUrlQuery has no move constructor despite having swap and move assignment. Because QUrlQuery fails to implement rule-of-5 this breaks types that have QUrlQuery members from being able to rely on rule-of-0.
static_assert(std::is_nothrow_move_assignable_v<QUrlQuery>); // ok static_assert(std::is_nothrow_move_constructible_v<QUrlQuery>); // fails
Workaround for types that want to rely on rule-of-0: default 4 special member functions and implement move constructor by swapping QUrlQuery objects.
class X { public: X() = default; ~X() = default; X(const X& other) = default; X& operator=(const X& other) = default; X(X&& other) noexcept // (std::move all members here except QUrlQuery) // (QUrlQuery will be default-constructed) { query.swap(other.query); } X& operator=(X&& other) noexcept = default; private: // other members... QUrlQuery query; };